@perspective-dev/client 5.8.0 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/ts/wasm/decompress.ts", "../../../src/ts/wasm/features.ts", "../../wasm/perspective-migrate.js", "../../../src/ts/wasm/migrate.ts", "../../../src/ts/wasm/cdn.ts", "../../../src/ts/wasm/registry.ts"],
4
- "sourcesContent": ["// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\ntype ModType = {\n resize: (x: number) => number;\n memory: WebAssembly.Memory;\n compile: (x: number, y: number) => number;\n};\n\nexport async function extract(input: any) {\n let bin: WebAssembly.WebAssemblyInstantiatedSource;\n if (input instanceof Response) {\n bin = await WebAssembly.instantiateStreaming(input);\n } else if (typeof input === \"string\") {\n bin = await WebAssembly.instantiateStreaming(fetch(input));\n } else if (input instanceof ArrayBuffer) {\n bin = await WebAssembly.instantiate(input);\n } else {\n bin = input;\n }\n\n const inst = bin.instance.exports as ModType;\n const [payload] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-runtime\",\n );\n\n const [raw_length_view] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-len\",\n );\n\n const raw_length = new DataView(raw_length_view).getUint32(0, true);\n const ptr = inst.resize(payload.byteLength);\n new Uint8Array(inst.memory.buffer).set(new Uint8Array(payload), ptr);\n const offset = inst.compile(payload.byteLength, raw_length);\n return new Uint8Array(inst.memory.buffer).slice(\n offset,\n raw_length + offset,\n );\n}\n\nif (typeof WebAssembly === \"undefined\") {\n throw new Error(\"WebAssembly not supported.\");\n}\n\ninterface Module extends WebAssembly.Exports {\n size(): number;\n offset(): number;\n memory: WebAssembly.Memory;\n}\n\nexport async function load_wasm_stage_0(\n wasm:\n | ArrayBuffer\n | Response\n | WebAssembly.Module\n | (() => Promise<ArrayBuffer>),\n): Promise<Uint8Array> {\n if (wasm instanceof Function) {\n wasm = await wasm();\n }\n\n if (wasm instanceof Promise) {\n wasm = await wasm;\n }\n\n try {\n return await extract(wasm as ArrayBuffer);\n } catch (e) {\n console.warn(\"Stage 0 wasm loading failed, skipping\");\n return new Uint8Array(wasm as ArrayBuffer);\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n// The encoding of `(module (memory i64 1))` \u2014 validates only on hosts with\n// WebAssembly Memory64 support (the same probe `wasm-feature-detect` uses).\nconst MEMORY64_PROBE = new Uint8Array([\n 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x04,\n 0x01,\n]);\n\nlet MEMORY64_SUPPORTED: boolean | undefined;\n\n/**\n * Does this JavaScript host support WebAssembly Memory64 (wasm64)?\n */\nexport function host_supports_memory64(): boolean {\n if (MEMORY64_SUPPORTED === undefined) {\n MEMORY64_SUPPORTED = WebAssembly.validate(MEMORY64_PROBE);\n }\n\n return MEMORY64_SUPPORTED;\n}\n", "/* @ts-self-types=\"./perspective-migrate.wasm.d.ts\" */\n\n/**\n * Upgrade a persisted Perspective config to the current schema, returning\n * `{value, notices, steps}`.\n * @param {string} kind\n * @param {string | null | undefined} from\n * @param {any} value\n * @returns {any}\n */\nexport function migrate(kind, from, value) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n var ptr1 = isLikeNone(from) ? 0 : passStringToWasm0(from, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n wasm.migrate(retptr, ptr0, len0, ptr1, len1, addHeapObject(value));\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {\n const ret = String(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {\n const v = getObject(arg1);\n const ret = typeof(v) === 'bigint' ? v : undefined;\n getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n },\n __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {\n const ret = getObject(arg0) in getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'bigint';\n return ret;\n },\n __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'function';\n return ret;\n },\n __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n },\n __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'string';\n return ret;\n },\n __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {\n const ret = getObject(arg0) === getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {\n const ret = getObject(arg0) == getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'number' ? obj : undefined;\n getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_done_57b39ecd9addfe81: function(arg0) {\n const ret = getObject(arg0).done;\n return ret;\n },\n __wbg_entries_58c7934c745daac7: function(arg0) {\n const ret = Object.entries(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {\n const ret = getObject(arg0)[arg1 >>> 0];\n return addHeapObject(ret);\n },\n __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(getObject(arg0), getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Map;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Uint8Array;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_isArray_d314bb98fcf08331: function(arg0) {\n const ret = Array.isArray(getObject(arg0));\n return ret;\n },\n __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {\n const ret = Number.isSafeInteger(getObject(arg0));\n return ret;\n },\n __wbg_iterator_6ff6560ca1568e55: function() {\n const ret = Symbol.iterator;\n return addHeapObject(ret);\n },\n __wbg_length_32ed9a279acd054c: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_length_35a7bace40f36eac: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_new_361308b2356cecd0: function() {\n const ret = new Object();\n return addHeapObject(ret);\n },\n __wbg_new_3eb36ae241fe6f44: function() {\n const ret = new Array();\n return addHeapObject(ret);\n },\n __wbg_new_dca287b076112a51: function() {\n const ret = new Map();\n return addHeapObject(ret);\n },\n __wbg_new_dd2b680c8bf6ae29: function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {\n const ret = getObject(arg0).next();\n return addHeapObject(ret);\n }, arguments); },\n __wbg_next_418f80d8f5303233: function(arg0) {\n const ret = getObject(arg0).next;\n return addHeapObject(ret);\n },\n __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n },\n __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {\n const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));\n return addHeapObject(ret);\n },\n __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {\n getObject(arg0)[takeObject(arg1)] = takeObject(arg2);\n },\n __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {\n getObject(arg0)[arg1 >>> 0] = takeObject(arg2);\n },\n __wbg_value_0546255b415e96c1: function(arg0) {\n const ret = getObject(arg0).value;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000001: function(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000002: function(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000003: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000004: function(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./perspective-migrate.wasm_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_export3(addHeapObject(e));\n }\n}\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport * as migrate_wasm from \"../../../dist/wasm/perspective-migrate.js\";\n\n/**\n * The kind of persisted config `migrate()` upgrades: an engine `ViewConfig`,\n * a `<perspective-viewer>` `save()` token, or a `saveWorkspace()` token.\n */\nexport type MigrateKind = \"view\" | \"viewer\" | \"workspace\";\n\n/**\n * Information `migrate()` could not carry into the current schema exactly.\n */\nexport type MigrateNotice =\n | { kind: \"Dropped\"; step: string; pointer: string; value: unknown }\n | { kind: \"Approximated\"; step: string; pointer: string; reason: string };\n\n/**\n * A config upgraded by `migrate()`, with what the upgrade dropped or\n * approximated and the ids of the schema changes it applied.\n */\nexport interface MigrateResult<T = Record<string, unknown>> {\n value: T;\n notices: MigrateNotice[];\n steps: string[];\n}\n\ntype MigrateBinary = BufferSource | WebAssembly.Module;\n\n/**\n * Instantiates the `perspective-migrate` WebAssembly module from its\n * registered source on the first `migrate()` call.\n */\nexport class MigrateLoader {\n private source?: () => Promise<MigrateBinary>;\n private module?: Promise<typeof migrate_wasm>;\n\n register(source: () => Promise<MigrateBinary>) {\n this.source = source;\n this.module = undefined;\n }\n\n async migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): Promise<MigrateResult<T>> {\n if (this.module === undefined) {\n if (this.source === undefined) {\n throw new Error(\"Missing perspective-migrate.wasm\");\n }\n\n const source = this.source;\n const module = source().then(async (module_or_path) => {\n await migrate_wasm.default({ module_or_path });\n return migrate_wasm;\n });\n\n this.module = module;\n module.catch(() => {\n if (this.module === module) {\n this.module = undefined;\n }\n });\n }\n\n const wasm = await this.module;\n return wasm.migrate(kind, from_version, config) as MigrateResult<T>;\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Resolve the URL of a WASM binary shipped in the `wasm_package` Perspective\n * package, relative to the URL of the `bundle_package` CDN bundle which loads\n * it.\n */\nexport function resolve_package_wasm_url(\n bundle_url: string,\n bundle_package: string,\n wasm_package: string,\n filename: string,\n): string {\n const pattern = new RegExp(\n `/${bundle_package}(@[^/]+)?/dist/cdn/[^/?#]*([?#].*)?$`,\n );\n\n const rewritten = bundle_url.replace(\n pattern,\n (_, tag) => `/${wasm_package}${tag ?? \"\"}/dist/wasm/${filename}`,\n );\n\n if (rewritten !== bundle_url) {\n return rewritten;\n }\n\n return new URL(`../../../${wasm_package}/dist/wasm/${filename}`, bundle_url)\n .href;\n}\n\n/**\n * Resolve the URL of one of `@perspective-dev/server`'s engine WASM binaries\n * relative to the URL of the `@perspective-dev/client` CDN bundle which loads\n * it.\n */\nexport function resolve_server_wasm_url(\n client_url: string,\n filename: string = \"perspective-server.wasm\",\n): string {\n return resolve_package_wasm_url(client_url, \"client\", \"server\", filename);\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * The page-wide WebAssembly registry shared by Perspective's packages, an\n * internal contract between them rather than a public API.\n *\n * @module\n */\n\nimport type * as psp from \"../../../dist/wasm/perspective-js.d.ts\";\nimport { load_wasm_stage_0 } from \"./decompress.ts\";\nimport { host_supports_memory64 } from \"./features.ts\";\nimport type { MigrateKind, MigrateResult } from \"./migrate.ts\";\n\nexport { MigrateLoader } from \"./migrate.ts\";\nexport type { MigrateKind, MigrateNotice, MigrateResult } from \"./migrate.ts\";\nexport { resolve_package_wasm_url } from \"./cdn.ts\";\n\ndeclare const __PSP_VERSION__: string;\n\n/**\n * A WebAssembly binary in a form `init()` accepts.\n */\nexport type WasmBinary =\n | Uint8Array\n | ArrayBuffer\n | Response\n | WebAssembly.Module;\n\n/**\n * A WebAssembly binary, a promise of one, or a thunk which is only invoked\n * when the binary is first needed.\n */\nexport type WasmSource =\n | WasmBinary\n | Promise<WasmBinary>\n | (() => Promise<WasmBinary>);\n\n/**\n * The WebAssembly binaries to register with `init()`, by role.\n */\nexport interface WasmRegistration {\n client?: WasmSource;\n viewer?: WasmSource;\n server?: WasmSource;\n server32?: WasmSource;\n server64?: WasmSource;\n migrate?: WasmSource;\n}\n\n/**\n * Options for `init()`, applied to the sources registered by that call.\n */\nexport interface InitOptions {\n disable_stage_0?: boolean;\n}\n\n/**\n * The initialized wasm-bindgen module backing every `Client` on the page.\n */\nexport interface ClientRuntime {\n glue: typeof psp;\n module?: WebAssembly.Module;\n}\n\n/**\n * Instantiates a package's wasm-bindgen module from its extracted binary.\n */\nexport type RuntimeProvider = (\n wasm: ArrayBuffer | WebAssembly.Module,\n) => Promise<ClientRuntime>;\n\n/**\n * A loader which runs `perspective-migrate` for `migrate()`.\n */\nexport interface MigrateHost {\n migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): Promise<MigrateResult<T>>;\n}\n\ntype WasmKey = keyof WasmRegistration;\n\ntype ServerKey = \"server\" | \"server32\" | \"server64\";\n\ntype RegisterMode = \"user\" | \"default\" | \"replace_server\";\n\ninterface Entry {\n source: WasmSource;\n disable_stage_0: boolean;\n is_default: boolean;\n}\n\ninterface RegistryState {\n sources: Partial<Record<WasmKey, Entry>>;\n consumed: Set<WasmKey>;\n client_provider?: RuntimeProvider;\n viewer_provider?: RuntimeProvider;\n client?: Promise<ClientRuntime>;\n client_origin?: \"client\" | \"viewer\" | \"glue\";\n client_runtime?: ClientRuntime;\n viewer?: Promise<ClientRuntime>;\n server?: Promise<ArrayBuffer | WebAssembly.Module>;\n migrate_binary?: Promise<ArrayBuffer | WebAssembly.Module>;\n migrate?: MigrateHost;\n}\n\nconst STATE_KEY = Symbol.for(\"@perspective-dev/wasm\");\n\nconst WASM_KEYS: WasmKey[] = [\n \"client\",\n \"viewer\",\n \"server\",\n \"server32\",\n \"server64\",\n \"migrate\",\n];\n\nconst SERVER_KEYS: ServerKey[] = [\"server\", \"server32\", \"server64\"];\n\nfunction is_server_key(key: WasmKey): key is ServerKey {\n return (SERVER_KEYS as WasmKey[]).includes(key);\n}\n\nfunction states(): Map<string, RegistryState> {\n const global = globalThis as any;\n global[STATE_KEY] ??= new Map();\n return global[STATE_KEY];\n}\n\nfunction state(): RegistryState {\n const all = states();\n let s = all.get(__PSP_VERSION__);\n if (s === undefined) {\n s = { sources: {}, consumed: new Set() };\n all.set(__PSP_VERSION__, s);\n }\n\n return s;\n}\n\nfunction assert_single_version() {\n const others = [...states().keys()].filter(\n (version) => version !== __PSP_VERSION__,\n );\n\n if (others.length > 0) {\n throw new Error(\n `Perspective ${__PSP_VERSION__} cannot share a page with Perspective ${others.join(\", \")}`,\n );\n }\n}\n\nasync function materialize({\n source,\n disable_stage_0,\n}: Entry): Promise<ArrayBuffer | WebAssembly.Module> {\n let wasm = typeof source === \"function\" ? await source() : await source;\n if (wasm instanceof WebAssembly.Module) {\n return wasm;\n }\n\n if (wasm instanceof Uint8Array) {\n wasm = wasm.slice().buffer as ArrayBuffer;\n }\n\n if (typeof Response !== \"undefined\" && wasm instanceof Response) {\n if (!wasm.ok) {\n throw new Error(\n `Failed to fetch perspective wasm (HTTP ${wasm.status} \"${wasm.url}\")`,\n );\n }\n\n if (disable_stage_0) {\n return await wasm.arrayBuffer();\n }\n }\n\n if (disable_stage_0) {\n return wasm as ArrayBuffer;\n }\n\n const bytes = await load_wasm_stage_0(wasm as ArrayBuffer | Response);\n return bytes.buffer as ArrayBuffer;\n}\n\nasync function select_server(\n sources: RegistryState[\"sources\"],\n): Promise<ArrayBuffer | WebAssembly.Module> {\n if (sources.server !== undefined) {\n return await materialize(sources.server);\n }\n\n const { server32, server64 } = sources;\n if (\n server64 !== undefined &&\n (server32 === undefined || host_supports_memory64())\n ) {\n try {\n return await materialize(server64);\n } catch (e) {\n if (server32 === undefined) {\n throw e;\n }\n\n console.warn(\n \"Memory64 perspective server wasm failed to load, falling back to wasm32\",\n e,\n );\n }\n }\n\n return await materialize(server32!);\n}\n\nfunction start_viewer(s: RegistryState) {\n s.consumed.add(\"viewer\");\n s.viewer = materialize(s.sources.viewer!).then(s.viewer_provider!);\n if (s.client === undefined) {\n s.client = s.viewer;\n s.client_origin = \"viewer\";\n s.viewer.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n}\n\n/**\n * Registers sources with the page-wide registry under the given mode.\n */\nexport function register(\n wasm: WasmRegistration,\n options: InitOptions = {},\n mode: RegisterMode = \"user\",\n) {\n if (mode !== \"default\") {\n assert_single_version();\n }\n\n const s = state();\n const unknown = Object.keys(wasm).filter(\n (key) => !WASM_KEYS.includes(key as WasmKey),\n );\n\n if (unknown.length > 0) {\n throw new Error(\n `Unknown perspective wasm key(s) ${unknown.join(\", \")}; expected ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n let keys = WASM_KEYS.filter((key) => wasm[key] !== undefined);\n if (mode === \"default\") {\n const has_server = SERVER_KEYS.some(\n (key) => s.sources[key] !== undefined,\n );\n\n keys = keys.filter(\n (key) =>\n s.sources[key] === undefined &&\n !s.consumed.has(key) &&\n !(has_server && is_server_key(key)),\n );\n } else {\n if (keys.length === 0) {\n throw new Error(\n `init() requires at least one of ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n for (const key of keys) {\n if (s.consumed.has(key)) {\n throw new Error(`${key} wasm is already initialized`);\n }\n }\n\n if (keys.some(is_server_key)) {\n for (const key of SERVER_KEYS) {\n if (mode === \"replace_server\" || s.sources[key]?.is_default) {\n delete s.sources[key];\n }\n }\n }\n }\n\n if (keys.includes(\"viewer\")) {\n if (s.client !== undefined) {\n throw new Error(\n \"viewer wasm must be registered before any Client is created from client wasm\",\n );\n }\n\n if (s.viewer_provider === undefined) {\n throw new Error(\n \"viewer wasm was registered, but @perspective-dev/viewer is not loaded\",\n );\n }\n }\n\n const servers = SERVER_KEYS.filter(\n (key) => keys.includes(key) || s.sources[key] !== undefined,\n );\n\n if (servers.includes(\"server\") && servers.length > 1) {\n throw new Error(\n \"`server` cannot be combined with `server32` or `server64`\",\n );\n }\n\n const disable_stage_0 = !!options.disable_stage_0;\n for (const key of keys) {\n s.sources[key] = {\n source: wasm[key]!,\n disable_stage_0,\n is_default: mode === \"default\",\n };\n }\n\n if (keys.includes(\"viewer\")) {\n start_viewer(s);\n }\n}\n\n/**\n * Register Perspective's WebAssembly binaries for this page, shared by every\n * copy of `@perspective-dev/client` and `@perspective-dev/viewer`, throwing if\n * another Perspective version has loaded on this page.\n *\n * # Arguments\n *\n * - `wasm` - Binaries by role: `client` (`perspective-js.wasm`), `viewer`\n * (`perspective-viewer.wasm`, which also backs every `Client`), `server`\n * (one engine build) or `server32` / `server64` (selected by Memory64\n * support), and `migrate` (`perspective-migrate.wasm`).\n * - `options` - `disable_stage_0` skips decompression for these sources.\n *\n * # Examples\n *\n * ```javascript\n * await perspective.init({\n * server32: () => fetch(SERVER_WASM),\n * server64: () => fetch(SERVER_MEMORY64_WASM),\n * viewer: fetch(VIEWER_WASM),\n * });\n * ```\n */\nexport async function init(\n wasm: WasmRegistration,\n options: InitOptions = {},\n): Promise<void> {\n register(wasm, options);\n if (wasm.viewer !== undefined) {\n await state().viewer;\n }\n}\n\n/**\n * Registers sources only for roles the page has not registered yet.\n */\nexport function register_default(wasm: WasmRegistration) {\n register(wasm, {}, \"default\");\n}\n\n/**\n * Installs the `client` role's runtime provider if none is installed.\n */\nexport function provide_client_runtime(provider: RuntimeProvider) {\n const s = state();\n s.client_provider ??= provider;\n}\n\n/**\n * Installs the `viewer` role's runtime provider if none is installed.\n */\nexport function provide_viewer_runtime(provider: RuntimeProvider) {\n const s = state();\n s.viewer_provider ??= provider;\n}\n\n/**\n * Backs every `Client` with an already-initialized wasm-bindgen module.\n */\nexport function provide_client_glue(glue: typeof psp) {\n const s = state();\n if (s.client !== undefined) {\n throw new Error(\"client wasm is already initialized\");\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"glue\";\n s.client_runtime = { glue };\n s.client = Promise.resolve(s.client_runtime);\n}\n\n/**\n * Resolves the runtime backing every `Client`, instantiating it on first use.\n */\nexport function resolve_client(): Promise<ClientRuntime> {\n const s = state();\n if (s.client === undefined) {\n const entry = s.sources.client;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-js.wasm: register `client` or `viewer` with init()\",\n ),\n );\n }\n\n if (s.client_provider === undefined) {\n return Promise.reject(\n new Error(\n \"client wasm was registered, but @perspective-dev/client is not loaded\",\n ),\n );\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"client\";\n s.client = materialize(entry).then(s.client_provider);\n s.client.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n\n return s.client;\n}\n\n/**\n * The runtime backing every `Client`, if it has finished initializing.\n */\nexport function client_runtime(): ClientRuntime | undefined {\n return (globalThis as any)[STATE_KEY]?.get(__PSP_VERSION__)?.client_runtime;\n}\n\n/**\n * Resolves once `<perspective-viewer>` is defined.\n */\nexport async function resolve_viewer(): Promise<void> {\n const viewer = state().viewer;\n if (viewer === undefined) {\n throw new Error(\n \"Missing perspective-viewer.wasm: register `viewer` with init()\",\n );\n }\n\n await viewer;\n}\n\n/**\n * Resolves the selected engine binary, a fresh copy per call.\n */\nexport function resolve_server(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.server === undefined) {\n if (!SERVER_KEYS.some((key) => s.sources[key] !== undefined)) {\n return Promise.reject(\n new Error(\n \"Missing perspective-server.wasm: register `server` (or `server32` / `server64`) with init()\",\n ),\n );\n }\n\n for (const key of SERVER_KEYS) {\n s.consumed.add(key);\n }\n\n s.server = select_server(s.sources);\n }\n\n return s.server.then((wasm) =>\n wasm instanceof WebAssembly.Module ? wasm : wasm.slice(0),\n );\n}\n\n/**\n * Resolves the extracted `perspective-migrate` binary.\n */\nexport function resolve_migrate(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.migrate_binary === undefined) {\n const entry = s.sources.migrate;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-migrate.wasm: register `migrate` with init()\",\n ),\n );\n }\n\n s.consumed.add(\"migrate\");\n s.migrate_binary = materialize(entry);\n }\n\n return s.migrate_binary;\n}\n\n/**\n * The page's one `migrate()` loader, installing `local` if there is none.\n */\nexport function shared_migrate(local: MigrateHost): MigrateHost {\n const s = state();\n s.migrate ??= local;\n return s.migrate;\n}\n"],
5
- "mappings": "0FAkBA,eAAsBA,EAAQC,EAAY,CACtC,IAAIC,EACAD,aAAiB,SACjBC,EAAM,MAAM,YAAY,qBAAqBD,CAAK,EAC3C,OAAOA,G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AAIF,EAAM,EAChB,GAAIE,EAAE,iBAAmB,OAAW,CAChC,IAAMgC,EAAQhC,EAAE,QAAQ,QACxB,GAAIgC,IAAU,OACV,OAAO,QAAQ,OACX,IAAI,MACA,kEACJ,CACJ,EAGJhC,EAAE,SAAS,IAAI,SAAS,EACxBA,EAAE,eAAiBI,EAAY4B,CAAK,CACxC,CAEA,OAAOhC,EAAE,cACb,CAKO,SAASsC,GAAeC,EAAiC,CAC5D,IAAMvC,EAAIF,EAAM,EAChB,OAAAE,EAAE,UAAYuC,EACPvC,EAAE,OACb",
6
- "names": ["extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "offset", "load_wasm_stage_0", "wasm", "MEMORY64_PROBE", "MEMORY64_SUPPORTED", "host_supports_memory64", "perspective_migrate_exports", "__export", "__wbg_init", "initSync", "migrate", "kind", "from", "value", "retptr", "wasm", "ptr0", "passStringToWasm0", "len0", "WASM_VECTOR_LEN", "ptr1", "isLikeNone", "len1", "addHeapObject", "r0", "getDataViewMemory0", "r1", "r2", "takeObject", "__wbg_get_imports", "arg0", "arg1", "ret", "getStringFromWasm0", "getObject", "v", "debugString", "val", "obj", "handleError", "result", "arg2", "getArrayU8FromWasm0", "heap_next", "heap", "idx", "type", "description", "name", "length", "debug", "i", "builtInMatches", "className", "dropObject", "ptr", "len", "getUint8ArrayMemory0", "cachedDataViewMemory0", "decodeText", "cachedUint8ArrayMemory0", "f", "args", "e", "x", "arg", "malloc", "realloc", "buf", "cachedTextEncoder", "mem", "offset", "code", "view", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "wasmModule", "__wbg_finalize_init", "instance", "module", "__wbg_load", "imports", "expectedResponseType", "bytes", "module_or_path", "MigrateLoader", "source", "kind", "config", "from_version", "module", "module_or_path", "__wbg_init", "perspective_migrate_exports", "resolve_package_wasm_url", "bundle_url", "bundle_package", "wasm_package", "filename", "pattern", "rewritten", "_", "tag", "STATE_KEY", "WASM_KEYS", "SERVER_KEYS", "is_server_key", "key", "states", "global", "state", "all", "s", "assert_single_version", "others", "version", "materialize", "source", "disable_stage_0", "wasm", "load_wasm_stage_0", "select_server", "sources", "server32", "server64", "host_supports_memory64", "e", "start_viewer", "runtime", "register", "options", "mode", "unknown", "keys", "has_server", "servers", "init", "register_default", "provide_client_runtime", "provider", "provide_viewer_runtime", "provide_client_glue", "glue", "resolve_client", "entry", "client_runtime", "resolve_viewer", "viewer", "resolve_server", "resolve_migrate", "shared_migrate", "local"]
4
+ "sourcesContent": ["// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\ntype ModType = {\n resize: (x: number) => number;\n memory: WebAssembly.Memory;\n compile: (x: number, y: number) => number;\n};\n\nexport async function extract(input: any) {\n let bin: WebAssembly.WebAssemblyInstantiatedSource;\n if (input instanceof Response) {\n bin = await WebAssembly.instantiateStreaming(input);\n } else if (typeof input === \"string\") {\n bin = await WebAssembly.instantiateStreaming(fetch(input));\n } else if (input instanceof ArrayBuffer) {\n bin = await WebAssembly.instantiate(input);\n } else {\n bin = input;\n }\n\n const inst = bin.instance.exports as ModType;\n const [payload] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-runtime\",\n );\n\n const [raw_length_view] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-len\",\n );\n\n const raw_length = new DataView(raw_length_view).getUint32(0, true);\n const ptr = inst.resize(payload.byteLength);\n new Uint8Array(inst.memory.buffer).set(new Uint8Array(payload), ptr);\n const offset = inst.compile(payload.byteLength, raw_length);\n return new Uint8Array(inst.memory.buffer).slice(\n offset,\n raw_length + offset,\n );\n}\n\nif (typeof WebAssembly === \"undefined\") {\n throw new Error(\"WebAssembly not supported.\");\n}\n\ninterface Module extends WebAssembly.Exports {\n size(): number;\n offset(): number;\n memory: WebAssembly.Memory;\n}\n\nexport async function load_wasm_stage_0(\n wasm:\n | ArrayBuffer\n | Response\n | WebAssembly.Module\n | (() => Promise<ArrayBuffer>),\n): Promise<Uint8Array> {\n if (wasm instanceof Function) {\n wasm = await wasm();\n }\n\n if (wasm instanceof Promise) {\n wasm = await wasm;\n }\n\n try {\n return await extract(wasm as ArrayBuffer);\n } catch (e) {\n console.warn(\"Stage 0 wasm loading failed, skipping\");\n return new Uint8Array(wasm as ArrayBuffer);\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n// The encoding of `(module (memory i64 1))` \u2014 validates only on hosts with\n// WebAssembly Memory64 support (the same probe `wasm-feature-detect` uses).\nconst MEMORY64_PROBE = new Uint8Array([\n 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x04,\n 0x01,\n]);\n\nlet MEMORY64_SUPPORTED: boolean | undefined;\n\n/**\n * Does this JavaScript host support WebAssembly Memory64 (wasm64)?\n */\nexport function host_supports_memory64(): boolean {\n if (MEMORY64_SUPPORTED === undefined) {\n MEMORY64_SUPPORTED = WebAssembly.validate(MEMORY64_PROBE);\n }\n\n return MEMORY64_SUPPORTED;\n}\n", "/* @ts-self-types=\"./perspective-migrate.wasm.d.ts\" */\n\n/**\n * Upgrade a persisted Perspective config to the current schema, returning\n * `{value, notices, steps}`.\n * @param {string} kind\n * @param {string | null | undefined} from\n * @param {any} value\n * @returns {any}\n */\nexport function migrate(kind, from, value) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n var ptr1 = isLikeNone(from) ? 0 : passStringToWasm0(from, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n wasm.migrate(retptr, ptr0, len0, ptr1, len1, addHeapObject(value));\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Check that a config is valid for the current schema without migrating it,\n * where `strict` requires the complete `save()` form.\n * @param {string} kind\n * @param {any} value\n * @param {boolean | null} [strict]\n */\nexport function validate_config(kind, value, strict) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n wasm.validate_config(retptr, ptr0, len0, addHeapObject(value), isLikeNone(strict) ? 0xFFFFFF : strict ? 1 : 0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {\n const ret = String(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {\n const v = getObject(arg1);\n const ret = typeof(v) === 'bigint' ? v : undefined;\n getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n },\n __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {\n const ret = getObject(arg0) in getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'bigint';\n return ret;\n },\n __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'function';\n return ret;\n },\n __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n },\n __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'string';\n return ret;\n },\n __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {\n const ret = getObject(arg0) === getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {\n const ret = getObject(arg0) == getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'number' ? obj : undefined;\n getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_done_57b39ecd9addfe81: function(arg0) {\n const ret = getObject(arg0).done;\n return ret;\n },\n __wbg_entries_58c7934c745daac7: function(arg0) {\n const ret = Object.entries(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {\n const ret = getObject(arg0)[arg1 >>> 0];\n return addHeapObject(ret);\n },\n __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(getObject(arg0), getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Map;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Uint8Array;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_isArray_d314bb98fcf08331: function(arg0) {\n const ret = Array.isArray(getObject(arg0));\n return ret;\n },\n __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {\n const ret = Number.isSafeInteger(getObject(arg0));\n return ret;\n },\n __wbg_iterator_6ff6560ca1568e55: function() {\n const ret = Symbol.iterator;\n return addHeapObject(ret);\n },\n __wbg_length_32ed9a279acd054c: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_length_35a7bace40f36eac: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_new_361308b2356cecd0: function() {\n const ret = new Object();\n return addHeapObject(ret);\n },\n __wbg_new_3eb36ae241fe6f44: function() {\n const ret = new Array();\n return addHeapObject(ret);\n },\n __wbg_new_dca287b076112a51: function() {\n const ret = new Map();\n return addHeapObject(ret);\n },\n __wbg_new_dd2b680c8bf6ae29: function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {\n const ret = getObject(arg0).next();\n return addHeapObject(ret);\n }, arguments); },\n __wbg_next_418f80d8f5303233: function(arg0) {\n const ret = getObject(arg0).next;\n return addHeapObject(ret);\n },\n __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n },\n __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {\n const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));\n return addHeapObject(ret);\n },\n __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {\n getObject(arg0)[takeObject(arg1)] = takeObject(arg2);\n },\n __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {\n getObject(arg0)[arg1 >>> 0] = takeObject(arg2);\n },\n __wbg_value_0546255b415e96c1: function(arg0) {\n const ret = getObject(arg0).value;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000001: function(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000002: function(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000003: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000004: function(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./perspective-migrate.wasm_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_export3(addHeapObject(e));\n }\n}\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport * as migrate_wasm from \"../../../dist/wasm/perspective-migrate.js\";\n\n/**\n * The kind of persisted config `migrate()` upgrades: an engine `ViewConfig`,\n * a `<perspective-viewer>` `save()` token, one workspace panel, or a\n * `saveWorkspace()` token.\n */\nexport type MigrateKind = \"view\" | \"viewer\" | \"panel\" | \"workspace\";\n\n/**\n * Information `migrate()` could not carry into the current schema exactly.\n */\nexport type MigrateNotice =\n | { kind: \"Dropped\"; step: string; pointer: string; value: unknown }\n | { kind: \"Approximated\"; step: string; pointer: string; reason: string };\n\n/**\n * A config upgraded by `migrate()`, with what the upgrade dropped or\n * approximated and the ids of the schema changes it applied.\n */\nexport interface MigrateResult<T = Record<string, unknown>> {\n value: T;\n notices: MigrateNotice[];\n steps: string[];\n}\n\n/**\n * Synchronous `migrate()` and `validate()` over an instantiated\n * `perspective-migrate` binary, from `create_validator()`.\n */\nexport interface Validator {\n /**\n * Upgrade a persisted config written by any Perspective release since\n * 2.0.0 to the current schema.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"` for a `ViewConfig`, `\"viewer\"` for a `save()`\n * token, `\"panel\"` for one workspace panel, or `\"workspace\"` for a\n * `saveWorkspace()` token.\n * - `config` - The config to upgrade.\n * - `from_version` - The release which wrote `config`, used only when it\n * has no `version` field.\n */\n migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): MigrateResult<T>;\n\n /**\n * Check that a config is valid for this release without migrating it,\n * throwing the offending JSON pointer and reason otherwise.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"`, `\"viewer\"`, `\"panel\"` or `\"workspace\"`.\n * - `config` - The config to check.\n * - `options.strict` - Require the complete `save()` form rather than the\n * field-wise `restore()` update form.\n */\n validate(\n kind: MigrateKind,\n config: unknown,\n options?: { strict?: boolean },\n ): void;\n}\n\n/**\n * Instantiate the `perspective-migrate` binary and wrap its exports as a\n * `Validator`.\n */\nexport async function load_validator(\n binary: BufferSource | WebAssembly.Module,\n): Promise<Validator> {\n await migrate_wasm.default({ module_or_path: binary });\n return {\n migrate<T>(kind: MigrateKind, config: unknown, from_version?: string) {\n return migrate_wasm.migrate(\n kind,\n from_version,\n config,\n ) as MigrateResult<T>;\n },\n validate(kind, config, options) {\n migrate_wasm.validate_config(kind, config, options?.strict);\n },\n };\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Resolve the URL of a WASM binary shipped in the `wasm_package` Perspective\n * package, relative to the URL of the `bundle_package` CDN bundle which loads\n * it.\n */\nexport function resolve_package_wasm_url(\n bundle_url: string,\n bundle_package: string,\n wasm_package: string,\n filename: string,\n): string {\n const pattern = new RegExp(\n `/${bundle_package}(@[^/]+)?/dist/cdn/[^/?#]*([?#].*)?$`,\n );\n\n const rewritten = bundle_url.replace(\n pattern,\n (_, tag) => `/${wasm_package}${tag ?? \"\"}/dist/wasm/${filename}`,\n );\n\n if (rewritten !== bundle_url) {\n return rewritten;\n }\n\n return new URL(`../../../${wasm_package}/dist/wasm/${filename}`, bundle_url)\n .href;\n}\n\n/**\n * Resolve the URL of one of `@perspective-dev/server`'s engine WASM binaries\n * relative to the URL of the `@perspective-dev/client` CDN bundle which loads\n * it.\n */\nexport function resolve_server_wasm_url(\n client_url: string,\n filename: string = \"perspective-server.wasm\",\n): string {\n return resolve_package_wasm_url(client_url, \"client\", \"server\", filename);\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * The page-wide WebAssembly registry shared by Perspective's packages, an\n * internal contract between them rather than a public API.\n *\n * @module\n */\n\nimport type * as psp from \"../../../dist/wasm/perspective-js.d.ts\";\nimport { load_wasm_stage_0 } from \"./decompress.ts\";\nimport { host_supports_memory64 } from \"./features.ts\";\nimport { load_validator } from \"./migrate.ts\";\nimport type { Validator } from \"./migrate.ts\";\n\nexport type {\n MigrateKind,\n MigrateNotice,\n MigrateResult,\n Validator,\n} from \"./migrate.ts\";\nexport { resolve_package_wasm_url } from \"./cdn.ts\";\n\ndeclare const __PSP_VERSION__: string;\n\n/**\n * A WebAssembly binary in a form `init()` accepts.\n */\nexport type WasmBinary =\n | Uint8Array\n | ArrayBuffer\n | Response\n | WebAssembly.Module;\n\n/**\n * A WebAssembly binary, a promise of one, or a thunk which is only invoked\n * when the binary is first needed.\n */\nexport type WasmSource =\n | WasmBinary\n | Promise<WasmBinary>\n | (() => Promise<WasmBinary>);\n\n/**\n * The WebAssembly binaries to register with `init()`, by role.\n */\nexport interface WasmRegistration {\n client?: WasmSource;\n viewer?: WasmSource;\n server?: WasmSource;\n server32?: WasmSource;\n server64?: WasmSource;\n migrate?: WasmSource;\n}\n\n/**\n * Options for `init()`, applied to the sources registered by that call.\n */\nexport interface InitOptions {\n disable_stage_0?: boolean;\n}\n\n/**\n * The initialized wasm-bindgen module backing every `Client` on the page.\n */\nexport interface ClientRuntime {\n glue: typeof psp;\n module?: WebAssembly.Module;\n}\n\n/**\n * Instantiates a package's wasm-bindgen module from its extracted binary.\n */\nexport type RuntimeProvider = (\n wasm: ArrayBuffer | WebAssembly.Module,\n) => Promise<ClientRuntime>;\n\ntype WasmKey = keyof WasmRegistration;\n\ntype ServerKey = \"server\" | \"server32\" | \"server64\";\n\ntype RegisterMode = \"user\" | \"default\" | \"replace_server\";\n\ninterface Entry {\n source: WasmSource;\n disable_stage_0: boolean;\n is_default: boolean;\n}\n\ninterface RegistryState {\n sources: Partial<Record<WasmKey, Entry>>;\n consumed: Set<WasmKey>;\n warned_duplicates?: Set<WasmKey>;\n client_provider?: RuntimeProvider;\n viewer_provider?: RuntimeProvider;\n client?: Promise<ClientRuntime>;\n client_origin?: \"client\" | \"viewer\" | \"glue\";\n client_runtime?: ClientRuntime;\n viewer?: Promise<ClientRuntime>;\n server?: Promise<ArrayBuffer | WebAssembly.Module>;\n migrate_binary?: Promise<ArrayBuffer | WebAssembly.Module>;\n validator?: Promise<Validator>;\n}\n\nconst STATE_KEY = Symbol.for(\"@perspective-dev/wasm\");\n\nconst WASM_KEYS: WasmKey[] = [\n \"client\",\n \"viewer\",\n \"server\",\n \"server32\",\n \"server64\",\n \"migrate\",\n];\n\nconst SERVER_KEYS: ServerKey[] = [\"server\", \"server32\", \"server64\"];\n\nfunction is_server_key(key: WasmKey): key is ServerKey {\n return (SERVER_KEYS as WasmKey[]).includes(key);\n}\n\nfunction states(): Map<string, RegistryState> {\n const global = globalThis as any;\n global[STATE_KEY] ??= new Map();\n return global[STATE_KEY];\n}\n\nfunction state(): RegistryState {\n const all = states();\n let s = all.get(__PSP_VERSION__);\n if (s === undefined) {\n s = { sources: {}, consumed: new Set() };\n all.set(__PSP_VERSION__, s);\n }\n\n return s;\n}\n\nfunction assert_single_version() {\n const others = [...states().keys()].filter(\n (version) => version !== __PSP_VERSION__,\n );\n\n if (others.length > 0) {\n throw new Error(\n `Perspective ${__PSP_VERSION__} cannot share a page with Perspective ${others.join(\", \")}`,\n );\n }\n}\n\nasync function materialize({\n source,\n disable_stage_0,\n}: Entry): Promise<ArrayBuffer | WebAssembly.Module> {\n let wasm = typeof source === \"function\" ? await source() : await source;\n if (wasm instanceof WebAssembly.Module) {\n return wasm;\n }\n\n if (wasm instanceof Uint8Array) {\n wasm = wasm.slice().buffer as ArrayBuffer;\n }\n\n if (typeof Response !== \"undefined\" && wasm instanceof Response) {\n if (!wasm.ok) {\n throw new Error(\n `Failed to fetch perspective wasm (HTTP ${wasm.status} \"${wasm.url}\")`,\n );\n }\n\n if (disable_stage_0) {\n return await wasm.arrayBuffer();\n }\n }\n\n if (disable_stage_0) {\n return wasm as ArrayBuffer;\n }\n\n const bytes = await load_wasm_stage_0(wasm as ArrayBuffer | Response);\n return bytes.buffer as ArrayBuffer;\n}\n\nasync function select_server(\n sources: RegistryState[\"sources\"],\n): Promise<ArrayBuffer | WebAssembly.Module> {\n if (sources.server !== undefined) {\n return await materialize(sources.server);\n }\n\n const { server32, server64 } = sources;\n if (\n server64 !== undefined &&\n (server32 === undefined || host_supports_memory64())\n ) {\n try {\n return await materialize(server64);\n } catch (e) {\n if (server32 === undefined) {\n throw e;\n }\n\n console.warn(\n \"Memory64 perspective server wasm failed to load, falling back to wasm32\",\n e,\n );\n }\n }\n\n return await materialize(server32!);\n}\n\nfunction start_viewer(s: RegistryState) {\n s.consumed.add(\"viewer\");\n s.viewer = materialize(s.sources.viewer!).then(s.viewer_provider!);\n if (s.client === undefined) {\n s.client = s.viewer;\n s.client_origin = \"viewer\";\n s.viewer.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n}\n\n/**\n * Registers sources with the page-wide registry under the given mode.\n */\nexport function register(\n wasm: WasmRegistration,\n options: InitOptions = {},\n mode: RegisterMode = \"user\",\n) {\n if (mode !== \"default\") {\n assert_single_version();\n }\n\n const s = state();\n const unknown = Object.keys(wasm).filter(\n (key) => !WASM_KEYS.includes(key as WasmKey),\n );\n\n if (unknown.length > 0) {\n throw new Error(\n `Unknown perspective wasm key(s) ${unknown.join(\", \")}; expected ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n let keys = WASM_KEYS.filter((key) => wasm[key] !== undefined);\n if (mode === \"default\") {\n const has_server = SERVER_KEYS.some(\n (key) => s.sources[key] !== undefined,\n );\n\n keys = keys.filter(\n (key) =>\n s.sources[key] === undefined &&\n !s.consumed.has(key) &&\n !(has_server && is_server_key(key)),\n );\n } else {\n if (keys.length === 0) {\n throw new Error(\n `init() requires at least one of ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n const duplicates: WasmKey[] = [];\n for (const key of keys) {\n if (s.consumed.has(key)) {\n // A module which calls `init()` at module scope may be\n // evaluated more than once per page (anywidget evaluates a\n // widget's `_esm` once per widget model, each evaluation a\n // fresh module instance over the page-wide registry).\n // Re-registering a key whose runtime already exists then\n // resolves to that runtime instead of throwing, in `user`\n // mode only \u2014 `replace_server` (`init_server()`) still\n // throws, as replacing a consumed engine remains an error.\n if (mode === \"user\" && s.sources[key] !== undefined) {\n duplicates.push(key);\n continue;\n }\n\n throw new Error(`${key} wasm is already initialized`);\n }\n }\n\n if (duplicates.length > 0) {\n keys = keys.filter((key) => !duplicates.includes(key));\n s.warned_duplicates ??= new Set();\n const un_warned = duplicates.filter(\n (key) => !s.warned_duplicates!.has(key),\n );\n\n if (un_warned.length > 0) {\n for (const key of un_warned) {\n s.warned_duplicates!.add(key);\n }\n\n console.warn(\n `${un_warned.join(\", \")} wasm is already initialized; keeping the existing runtime (Perspective was loaded more than once on this page).`,\n );\n }\n }\n\n if (keys.some(is_server_key)) {\n for (const key of SERVER_KEYS) {\n if (mode === \"replace_server\" || s.sources[key]?.is_default) {\n delete s.sources[key];\n }\n }\n }\n }\n\n if (keys.includes(\"viewer\")) {\n if (s.client !== undefined) {\n throw new Error(\n \"viewer wasm must be registered before any Client is created from client wasm\",\n );\n }\n\n if (s.viewer_provider === undefined) {\n throw new Error(\n \"viewer wasm was registered, but @perspective-dev/viewer is not loaded\",\n );\n }\n }\n\n const servers = SERVER_KEYS.filter(\n (key) => keys.includes(key) || s.sources[key] !== undefined,\n );\n\n if (servers.includes(\"server\") && servers.length > 1) {\n throw new Error(\n \"`server` cannot be combined with `server32` or `server64`\",\n );\n }\n\n const disable_stage_0 = !!options.disable_stage_0;\n for (const key of keys) {\n s.sources[key] = {\n source: wasm[key]!,\n disable_stage_0,\n is_default: mode === \"default\",\n };\n }\n\n if (keys.includes(\"viewer\")) {\n start_viewer(s);\n }\n}\n\n/**\n * Register Perspective's WebAssembly binaries for this page, shared by every\n * copy of `@perspective-dev/client` and `@perspective-dev/viewer`, throwing if\n * another Perspective version has loaded on this page.\n *\n * Re-registering a key whose runtime already exists (e.g. a second module\n * evaluation of the same bundle, as anywidget does per widget model) keeps\n * the existing runtime and resolves rather than throwing; `init_server()`'s\n * replacement mode still throws for a consumed key.\n *\n * # Arguments\n *\n * - `wasm` - Binaries by role: `client` (`perspective-js.wasm`), `viewer`\n * (`perspective-viewer.wasm`, which also backs every `Client`), `server`\n * (one engine build) or `server32` / `server64` (selected by Memory64\n * support), and `migrate` (`perspective-migrate.wasm`).\n * - `options` - `disable_stage_0` skips decompression for these sources.\n *\n * # Examples\n *\n * ```javascript\n * await perspective.init({\n * server32: () => fetch(SERVER_WASM),\n * server64: () => fetch(SERVER_MEMORY64_WASM),\n * viewer: fetch(VIEWER_WASM),\n * });\n * ```\n */\nexport async function init(\n wasm: WasmRegistration,\n options: InitOptions = {},\n): Promise<void> {\n register(wasm, options);\n if (wasm.viewer !== undefined) {\n await state().viewer;\n }\n}\n\n/**\n * Registers sources only for roles the page has not registered yet.\n */\nexport function register_default(wasm: WasmRegistration) {\n register(wasm, {}, \"default\");\n}\n\n/**\n * Installs the `client` role's runtime provider if none is installed.\n */\nexport function provide_client_runtime(provider: RuntimeProvider) {\n const s = state();\n s.client_provider ??= provider;\n}\n\n/**\n * Installs the `viewer` role's runtime provider if none is installed.\n */\nexport function provide_viewer_runtime(provider: RuntimeProvider) {\n const s = state();\n s.viewer_provider ??= provider;\n}\n\n/**\n * Backs every `Client` with an already-initialized wasm-bindgen module.\n */\nexport function provide_client_glue(glue: typeof psp) {\n const s = state();\n if (s.client !== undefined) {\n throw new Error(\"client wasm is already initialized\");\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"glue\";\n s.client_runtime = { glue };\n s.client = Promise.resolve(s.client_runtime);\n}\n\n/**\n * Resolves the runtime backing every `Client`, instantiating it on first use.\n */\nexport function resolve_client(): Promise<ClientRuntime> {\n const s = state();\n if (s.client === undefined) {\n const entry = s.sources.client;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-js.wasm: register `client` or `viewer` with init()\",\n ),\n );\n }\n\n if (s.client_provider === undefined) {\n return Promise.reject(\n new Error(\n \"client wasm was registered, but @perspective-dev/client is not loaded\",\n ),\n );\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"client\";\n s.client = materialize(entry).then(s.client_provider);\n s.client.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n\n return s.client;\n}\n\n/**\n * The runtime backing every `Client`, if it has finished initializing.\n */\nexport function client_runtime(): ClientRuntime | undefined {\n return (globalThis as any)[STATE_KEY]?.get(__PSP_VERSION__)?.client_runtime;\n}\n\n/**\n * Resolves once `<perspective-viewer>` is defined.\n */\nexport async function resolve_viewer(): Promise<void> {\n const viewer = state().viewer;\n if (viewer === undefined) {\n throw new Error(\n \"Missing perspective-viewer.wasm: register `viewer` with init()\",\n );\n }\n\n await viewer;\n}\n\n/**\n * Resolves the selected engine binary, a fresh copy per call.\n */\nexport function resolve_server(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.server === undefined) {\n if (!SERVER_KEYS.some((key) => s.sources[key] !== undefined)) {\n return Promise.reject(\n new Error(\n \"Missing perspective-server.wasm: register `server` (or `server32` / `server64`) with init()\",\n ),\n );\n }\n\n for (const key of SERVER_KEYS) {\n s.consumed.add(key);\n }\n\n s.server = select_server(s.sources);\n }\n\n return s.server.then((wasm) =>\n wasm instanceof WebAssembly.Module ? wasm : wasm.slice(0),\n );\n}\n\n/**\n * Resolves the extracted `perspective-migrate` binary.\n */\nexport function resolve_migrate(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.migrate_binary === undefined) {\n const entry = s.sources.migrate;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-migrate.wasm: register `migrate` with init()\",\n ),\n );\n }\n\n s.consumed.add(\"migrate\");\n s.migrate_binary = materialize(entry);\n }\n\n return s.migrate_binary;\n}\n\n/**\n * The page's one `Validator`, instantiated from the registered `migrate`\n * binary on the first call.\n */\nexport function shared_validator(): Promise<Validator> {\n const s = state();\n if (s.validator === undefined) {\n const validator = resolve_migrate().then(load_validator);\n validator.catch(() => {\n if (s.validator === validator) {\n s.validator = undefined;\n }\n });\n\n s.validator = validator;\n }\n\n return s.validator;\n}\n"],
5
+ "mappings": "AAkBA,eAAsBA,EAAQC,EAAY,CACtC,IAAIC,EACAD,aAAiB,SACjBC,EAAM,MAAM,YAAY,qBAAqBD,CAAK,EAC3C,OAAOA,GAAU,SACxBC,EAAM,MAAM,YAAY,qBAAqB,MAAMD,CAAK,CAAC,EAClDA,aAAiB,YACxBC,EAAM,MAAM,YAAY,YAAYD,CAAK,EAEzCC,EAAMD,EAGV,IAAME,EAAOD,EAAI,SAAS,QACpB,CAACE,CAAO,EAAI,YAAY,OAAO,eACjCF,EAAI,OACJ,aACJ,EAEM,CAACG,CAAe,EAAI,YAAY,OAAO,eACzCH,EAAI,OACJ,SACJ,EAEMI,EAAa,IAAI,SAASD,CAAe,EAAE,UAAU,EAAG,EAAI,EAC5DE,EAAMJ,EAAK,OAAOC,EAAQ,UAAU,EAC1C,IAAI,WAAWD,EAAK,OAAO,MAAM,EAAE,IAAI,IAAI,WAAWC,CAAO,EAAGG,CAAG,EACnE,IAAMC,EAASL,EAAK,QAAQC,EAAQ,WAAYE,CAAU,EAC1D,OAAO,IAAI,WAAWH,EAAK,OAAO,MAAM,EAAE,MACtCK,EACAF,EAAaE,CACjB,CACJ,CAEA,GAAI,OAAO,YAAgB,IACvB,MAAM,IAAI,MAAM,4BAA4B,EAShD,eAAsBC,EAClBC,EAKmB,CACfA,aAAgB,WAChBA,EAAO,MAAMA,EAAK,GAGlBA,aAAgB,UAChBA,EAAO,MAAMA,GAGjB,GAAI,CACA,OAAO,MAAMV,EAAQU,CAAmB,CAC5C,MAAY,CACR,eAAQ,KAAK,uCAAuC,EAC7C,IAAI,WAAWA,CAAmB,CAC7C,CACJ,CCpEA,IAAMC,EAAiB,IAAI,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AOhB,EAAE,MACb,CAKO,SAASmC,IAA4C,CACxD,OAAQ,WAAmB5C,CAAS,GAAG,IAAI,OAAe,GAAG,cACjE,CAKA,eAAsB6C,IAAgC,CAClD,IAAMC,EAASvC,EAAM,EAAE,OACvB,GAAIuC,IAAW,OACX,MAAM,IAAI,MACN,gEACJ,EAGJ,MAAMA,CACV,CAKO,SAASC,IAA4D,CACxE,IAAMtC,EAAIF,EAAM,EAChB,GAAIE,EAAE,SAAW,OAAW,CACxB,GAAI,CAACP,EAAY,KAAME,GAAQK,EAAE,QAAQL,CAAG,IAAM,MAAS,EACvD,OAAO,QAAQ,OACX,IAAI,MACA,6FACJ,CACJ,EAGJ,QAAWA,KAAOF,EACdO,EAAE,SAAS,IAAIL,CAAG,EAGtBK,EAAE,OAASS,GAAcT,EAAE,OAAO,CACtC,CAEA,OAAOA,EAAE,OAAO,KAAMO,GAClBA,aAAgB,YAAY,OAASA,EAAOA,EAAK,MAAM,CAAC,CAC5D,CACJ,CAKO,SAASgC,IAA6D,CACzE,IAAMvC,EAAIF,EAAM,EAChB,GAAIE,EAAE,iBAAmB,OAAW,CAChC,IAAMkC,EAAQlC,EAAE,QAAQ,QACxB,GAAIkC,IAAU,OACV,OAAO,QAAQ,OACX,IAAI,MACA,kEACJ,CACJ,EAGJlC,EAAE,SAAS,IAAI,SAAS,EACxBA,EAAE,eAAiBI,EAAY8B,CAAK,CACxC,CAEA,OAAOlC,EAAE,cACb,CAMO,SAASwC,IAAuC,CACnD,IAAMxC,EAAIF,EAAM,EAChB,GAAIE,EAAE,YAAc,OAAW,CAC3B,IAAMyC,EAAYF,GAAgB,EAAE,KAAKG,CAAc,EACvDD,EAAU,MAAM,IAAM,CACdzC,EAAE,YAAcyC,IAChBzC,EAAE,UAAY,OAEtB,CAAC,EAEDA,EAAE,UAAYyC,CAClB,CAEA,OAAOzC,EAAE,SACb",
6
+ "names": ["extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "offset", "load_wasm_stage_0", "wasm", "MEMORY64_PROBE", "MEMORY64_SUPPORTED", "host_supports_memory64", "migrate", "kind", "from", "value", "retptr", "wasm", "ptr0", "passStringToWasm0", "len0", "WASM_VECTOR_LEN", "ptr1", "isLikeNone", "len1", "addHeapObject", "r0", "getDataViewMemory0", "r1", "r2", "takeObject", "validate_config", "strict", "__wbg_get_imports", "arg0", "arg1", "ret", "getStringFromWasm0", "getObject", "v", "debugString", "val", "obj", "handleError", "result", "arg2", "getArrayU8FromWasm0", "heap_next", "heap", "idx", "type", "description", "name", "length", "debug", "i", "builtInMatches", "className", "dropObject", "ptr", "len", "getUint8ArrayMemory0", "cachedDataViewMemory0", "decodeText", "cachedUint8ArrayMemory0", "f", "args", "e", "x", "arg", "malloc", "realloc", "buf", "cachedTextEncoder", "mem", "offset", "code", "view", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "wasmModule", "__wbg_finalize_init", "instance", "module", "__wbg_load", "imports", "expectedResponseType", "bytes", "__wbg_init", "module_or_path", "wasm", "imports", "__wbg_get_imports", "instance", "module", "__wbg_load", "__wbg_finalize_init", "load_validator", "binary", "__wbg_init", "kind", "config", "from_version", "migrate", "options", "validate_config", "resolve_package_wasm_url", "bundle_url", "bundle_package", "wasm_package", "filename", "pattern", "rewritten", "_", "tag", "STATE_KEY", "WASM_KEYS", "SERVER_KEYS", "is_server_key", "key", "states", "global", "state", "all", "s", "assert_single_version", "others", "version", "materialize", "source", "disable_stage_0", "wasm", "load_wasm_stage_0", "select_server", "sources", "server32", "server64", "host_supports_memory64", "e", "start_viewer", "runtime", "register", "options", "mode", "unknown", "keys", "has_server", "duplicates", "un_warned", "servers", "init", "register_default", "provide_client_runtime", "provider", "provide_viewer_runtime", "provide_client_glue", "glue", "resolve_client", "entry", "client_runtime", "resolve_viewer", "viewer", "resolve_server", "resolve_migrate", "shared_validator", "validator", "load_validator"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- import type { ViewOnRemoveResp } from "./ViewOnRemoveResp.d.ts";
2
+ import type { RemoveCause } from "./RemoveCause.d.ts";
3
3
 
4
4
  /**
5
- * Removed index values and port ID corresponding to a remove batch, provided
6
- * to the callback argument to [`View::on_remove`].
5
+ * The keys of rows which left a [`View`], the port ID and the [`RemoveCause`]
6
+ * they left under, provided to the callback argument to [`View::on_remove`].
7
7
  */
8
- export type OnRemoveData = ViewOnRemoveResp;
8
+ export type OnRemoveData = { port_id: number, indices: Uint8Array | undefined, cause: RemoveCause, };
@@ -0,0 +1,7 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * The rule under which the rows reported by [`View::on_remove`] left the
5
+ * [`View`].
6
+ */
7
+ export type RemoveCause = "key" | "group" | "filter";
@@ -152,7 +152,7 @@ export type * from "../ts-rs/ColumnWindow.d.ts";
152
152
  export type * from "../ts-rs/TableInitOptions.d.ts";
153
153
  export type * from "../ts-rs/ViewConfigUpdate.d.ts";
154
154
  export type * from "../ts-rs/ViewOnUpdateResp.d.ts";
155
- export type * from "../ts-rs/ViewOnRemoveResp.d.ts";
155
+ export type * from "../ts-rs/RemoveCause.d.ts";
156
156
  export type * from "../ts-rs/OnRemoveData.d.ts";
157
157
  export type * from "../ts-rs/OnUpdateData.d.ts";
158
158
  export type * from "../ts-rs/OnUpdateOptions.d.ts";
@@ -658,7 +658,7 @@ export class Table {
658
658
  * [`Table::on_delete`] resolves when the subscription message is sent, not
659
659
  * when the _delete_ event occurs.
660
660
  */
661
- on_delete(on_delete: Function): Promise<any>;
661
+ on_delete(on_delete: Function): Promise<number>;
662
662
  /**
663
663
  * Removes rows from this [`Table`] with the `index` column values
664
664
  * supplied.
@@ -681,7 +681,7 @@ export class Table {
681
681
  * Removes a listener with a given ID, as returned by a previous call to
682
682
  * [`Table::on_delete`].
683
683
  */
684
- remove_delete(callback_id: number): Promise<any>;
684
+ remove_delete(callback_id: number): Promise<void>;
685
685
  /**
686
686
  * Replace all rows in this [`Table`] with the input data, coerced to this
687
687
  * [`Table`]'s existing [`perspective_client::Schema`], notifying any
@@ -749,7 +749,7 @@ export class Table {
749
749
  * await table.update("x,y\n1,2");
750
750
  * ```
751
751
  */
752
- update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<any>;
752
+ update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<void>;
753
753
  /**
754
754
  * Validates the given expressions.
755
755
  */
@@ -887,26 +887,31 @@ export class View {
887
887
  * Register a callback with this [`View`]. Whenever the [`View`] is
888
888
  * deleted, this callback will be invoked.
889
889
  */
890
- on_delete(on_delete: Function): Promise<any>;
890
+ on_delete(on_delete: Function): Promise<number>;
891
891
  /**
892
- * Register a callback which is invoked whenever rows are removed from
893
- * this [`View`]'s [`Table`] by [`Table::remove`], with an object
894
- * containing `port_id` and `indices`, the removed `index` column
895
- * values as an Arrow of one column named after the index.
892
+ * Register a callback which is invoked whenever rows leave this
893
+ * [`View`], with an object containing `port_id`, `indices` (their keys
894
+ * as an Arrow of one column per key column named after it) and `cause`,
895
+ * one of `"key"`, `"filter"` or `"group"`.
896
896
  *
897
- * [`Table::replace`] reports the keys it does not re-supply and
898
- * [`Table::clear`] reports every key. `on_remove` never fires for a
899
- * [`Table`] without an `index`.
897
+ * For a [`View`] without `group_by` the keys are the `index` columns of
898
+ * the [`Table`], which must have one: `"key"` when [`Table::remove`]
899
+ * removed them ([`Table::replace`] reports the keys it does not
900
+ * re-supply and [`Table::clear`] every key) and `"filter"` when
901
+ * [`Table::update`] moved them outside the [`View`]'s `filter`. For a
902
+ * [`View`] with `group_by` the keys are the `group_by` columns of each
903
+ * group which no longer has any rows, `"group"`, `null` below the
904
+ * group's depth. It fires once per cause per update step.
900
905
  *
901
906
  * # JavaScript Examples
902
907
  *
903
908
  * ```javascript
904
- * const id = await view.on_remove(({ indices, port_id }) => {
909
+ * const id = await view.on_remove(({ indices, port_id, cause }) => {
905
910
  * replica.remove(indices);
906
911
  * });
907
912
  * ```
908
913
  */
909
- on_remove(on_remove_js: (data: OnRemoveData) => void): Promise<any>;
914
+ on_remove(on_remove_js: (data: OnRemoveData) => void): Promise<number>;
910
915
  /**
911
916
  * Register a callback with this [`View`]. Whenever the view's underlying
912
917
  * table emits an update, this callback will be invoked with an object
@@ -933,11 +938,11 @@ export class View {
933
938
  * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
934
939
  * ```
935
940
  */
936
- on_update(on_update_js: (data: OnUpdateData) => void, options?: OnUpdateOptions | null): Promise<any>;
941
+ on_update(on_update_js: (data: OnUpdateData) => void, options?: OnUpdateOptions | null): Promise<number>;
937
942
  /**
938
943
  * Unregister a previously registered [`View::on_delete`] callback.
939
944
  */
940
- remove_delete(callback_id: number): Promise<any>;
945
+ remove_delete(callback_id: number): Promise<void>;
941
946
  /**
942
947
  * Unregister a previously registered [`View::on_remove`] callback.
943
948
  *
@@ -1049,7 +1054,7 @@ export class VirtualDataSlice {
1049
1054
  export class VirtualServer {
1050
1055
  free(): void;
1051
1056
  [Symbol.dispose](): void;
1052
- handleRequest(bytes: Uint8Array): Promise<any>;
1057
+ handleRequest(bytes: Uint8Array): Promise<Uint8Array>;
1053
1058
  constructor(handler: VirtualServerHandler);
1054
1059
  }
1055
1060
 
@@ -1163,12 +1168,12 @@ export interface InitOutput {
1163
1168
  readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1164
1169
  readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
1165
1170
  readonly virtualserver_new: (a: number, b: number) => void;
1166
- readonly __wasm_bindgen_func_elem_1738: (a: number, b: number) => void;
1167
- readonly __wasm_bindgen_func_elem_4802: (a: number, b: number) => void;
1168
- readonly __wasm_bindgen_func_elem_13337: (a: number, b: number, c: number, d: number) => void;
1169
- readonly __wasm_bindgen_func_elem_4804: (a: number, b: number, c: number) => void;
1170
- readonly __wasm_bindgen_func_elem_2108: (a: number, b: number) => number;
1171
- readonly __wasm_bindgen_func_elem_2109: (a: number, b: number) => void;
1171
+ readonly __wasm_bindgen_func_elem_1727: (a: number, b: number) => void;
1172
+ readonly __wasm_bindgen_func_elem_4768: (a: number, b: number) => void;
1173
+ readonly __wasm_bindgen_func_elem_13335: (a: number, b: number, c: number, d: number) => void;
1174
+ readonly __wasm_bindgen_func_elem_4770: (a: number, b: number, c: number) => void;
1175
+ readonly __wasm_bindgen_func_elem_2093: (a: number, b: number) => number;
1176
+ readonly __wasm_bindgen_func_elem_2094: (a: number, b: number) => void;
1172
1177
  readonly __wbindgen_export: (a: number, b: number) => number;
1173
1178
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
1174
1179
  readonly __wbindgen_export3: (a: number) => void;