/* @ts-self-types="./extension_js.d.ts" */
import * as import1 from "env";
import * as import2 from "env";
import * as import3 from "env";
import * as import4 from "env";
import * as import5 from "env";
import * as import6 from "env";
import * as import7 from "env";
import * as import8 from "env";
import * as import9 from "env";
import * as import10 from "env";
import * as import11 from "env";
import * as import12 from "env";
import * as import13 from "env";
import * as import14 from "env";
import * as import15 from "env";
import * as import16 from "env";
import * as import17 from "env";
import * as import18 from "env";
import * as import19 from "env";
import * as import20 from "env";
import * as import21 from "env";
import * as import22 from "env";
import * as import23 from "env";
import * as import24 from "env";
import * as import25 from "env";
import * as import26 from "env";
import * as import27 from "env";
import * as import28 from "env";
import * as import29 from "env";
import * as import30 from "env";
import * as import31 from "env";

//#region exports

/**
 * ExtensionSession wraps BaseSession for the Chrome Extension environment.
 * WASM runs inside a Web Worker; all browser side-effects are relayed
 * to the main-thread runner via the `__extension_js_relay` global function.
 */
export class ExtensionSession {
	__destroy_into_raw() {
		const ptr = this.__wbg_ptr;
		this.__wbg_ptr = 0;
		ExtensionSessionFinalization.unregister(this);
		return ptr;
	}
	free() {
		const ptr = this.__destroy_into_raw();
		wasm.__wbg_extensionsession_free(ptr, 0);
	}
	/**
	 * Inspect all global variables in the current JS state.
	 * @returns {WasmGlobalsSnapshot}
	 */
	inspect_globals() {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		const ret = wasm.extensionsession_inspect_globals(this.__wbg_ptr);
		return ret;
	}
	/**
	 * Load a JS library by executing its source code.
	 * @param {string} source
	 * @returns {CellResult}
	 */
	load_library(source) {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		const ptr0 = passStringToWasm0(
			source,
			wasm.__wbindgen_malloc,
			wasm.__wbindgen_realloc,
		);
		const len0 = WASM_VECTOR_LEN;
		const ret = wasm.extensionsession_load_library(this.__wbg_ptr, ptr0, len0);
		return ret;
	}
	/**
	 * Create a new extension session.
	 */
	constructor() {
		const ret = wasm.extensionsession_new();
		this.__wbg_ptr = ret;
		ExtensionSessionFinalization.register(this, this.__wbg_ptr, this);
		return this;
	}
	/**
	 * Reset the session, clearing all JS state.
	 */
	reset() {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		wasm.extensionsession_reset(this.__wbg_ptr);
	}
	/**
	 * Run a cell, automatically resolving all async calls by relaying
	 * them to the main-thread runner via `__extension_js_relay`.
	 * @param {string} code
	 * @param {string} stdin
	 * @returns {Promise<CellResult>}
	 */
	runCellAsync(code, stdin) {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		const ptr0 = passStringToWasm0(
			code,
			wasm.__wbindgen_malloc,
			wasm.__wbindgen_realloc,
		);
		const len0 = WASM_VECTOR_LEN;
		const ptr1 = passStringToWasm0(
			stdin,
			wasm.__wbindgen_malloc,
			wasm.__wbindgen_realloc,
		);
		const len1 = WASM_VECTOR_LEN;
		const ret = wasm.extensionsession_runCellAsync(
			this.__wbg_ptr,
			ptr0,
			len0,
			ptr1,
			len1,
		);
		return ret;
	}
	/**
	 * Set the fuel limit for execution.
	 * @param {number} limit
	 */
	set_fuel_limit(limit) {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		_assertNum(limit);
		wasm.extensionsession_set_fuel_limit(this.__wbg_ptr, limit);
	}
	/**
	 * Clean up the session and release resources.
	 */
	stopWith() {
		if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
		_assertNum(this.__wbg_ptr);
		wasm.extensionsession_stopWith(this.__wbg_ptr);
	}
}
if (Symbol.dispose)
	ExtensionSession.prototype[Symbol.dispose] = ExtensionSession.prototype.free;

/**
 * @param {CollectOptions} options
 * @returns {TreeSnapshot}
 */
export function collect_document(options) {
	const ret = wasm.collect_document(options);
	return ret;
}

/**
 * @param {Element} root
 * @param {CollectOptions} options
 * @returns {TreeSnapshot}
 */
export function collect_element(root, options) {
	const ret = wasm.collect_element(root, options);
	return ret;
}

/**
 * @param {TreeSnapshot} snapshot
 * @param {SnapshotFormat | null} [format]
 * @returns {string}
 */
export function format_snapshot_js(snapshot, format) {
	let deferred1_0;
	let deferred1_1;
	try {
		const ret = wasm.format_snapshot_js(
			snapshot,
			isLikeNone(format) ? 0 : addToExternrefTable0(format),
		);
		deferred1_0 = ret[0];
		deferred1_1 = ret[1];
		return getStringFromWasm0(ret[0], ret[1]);
	} finally {
		wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
	}
}

/**
 * @param {string} format
 * @returns {string}
 */
export function generateApiDocs(format) {
	let deferred2_0;
	let deferred2_1;
	try {
		const ptr0 = passStringToWasm0(
			format,
			wasm.__wbindgen_malloc,
			wasm.__wbindgen_realloc,
		);
		const len0 = WASM_VECTOR_LEN;
		const ret = wasm.generateApiDocs(ptr0, len0);
		deferred2_0 = ret[0];
		deferred2_1 = ret[1];
		return getStringFromWasm0(ret[0], ret[1]);
	} finally {
		wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
	}
}

/**
 * 0=debug, 1=info, 2=warn, 3=error, 4=none
 * @param {number} level
 */
export function setLogLevel(level) {
	_assertNum(level);
	wasm.setLogLevel(level);
}

//#endregion

//#region wasm imports
function __wbg_get_imports() {
	const import0 = {
		__proto__: null,
		__wbg_URL_770be900109120c5: function () {
			return handleError(function (arg0, arg1) {
				const ret = arg1.URL;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg___extension_js_relay_4838b4e1bcf11b70: function () {
			return logError(function (arg0) {
				const ret = __extension_js_relay(arg0);
				return ret;
			}, arguments);
		},
		__wbg___wbindgen_debug_string_0accd80f45e5faa2: function (arg0, arg1) {
			const ret = debugString(arg1);
			const ptr1 = passStringToWasm0(
				ret,
				wasm.__wbindgen_malloc,
				wasm.__wbindgen_realloc,
			);
			const len1 = WASM_VECTOR_LEN;
			getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
			getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
		},
		__wbg___wbindgen_is_function_754e9f305ff6029e: function (arg0) {
			const ret = typeof arg0 === "function";
			_assertBoolean(ret);
			return ret;
		},
		__wbg___wbindgen_is_undefined_67b456be8673d3d7: function (arg0) {
			const ret = arg0 === undefined;
			_assertBoolean(ret);
			return ret;
		},
		__wbg___wbindgen_number_get_9bb1761122181af2: function (arg0, arg1) {
			const obj = arg1;
			const ret = typeof obj === "number" ? obj : undefined;
			if (!isLikeNone(ret)) {
				_assertNum(ret);
			}
			getDataViewMemory0().setFloat64(
				arg0 + 8 * 1,
				isLikeNone(ret) ? 0 : ret,
				true,
			);
			getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
		},
		__wbg___wbindgen_string_get_72bdf95d3ae505b1: function (arg0, arg1) {
			const obj = arg1;
			const ret = typeof obj === "string" ? obj : undefined;
			var ptr1 = isLikeNone(ret)
				? 0
				: passStringToWasm0(
						ret,
						wasm.__wbindgen_malloc,
						wasm.__wbindgen_realloc,
					);
			var len1 = WASM_VECTOR_LEN;
			getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
			getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
		},
		__wbg___wbindgen_throw_1506f2235d1bdba0: function (arg0, arg1) {
			throw new Error(getStringFromWasm0(arg0, arg1));
		},
		__wbg__wbg_cb_unref_61db23ac97f16c31: function () {
			return logError(function (arg0) {
				arg0._wbg_cb_unref();
			}, arguments);
		},
		__wbg_body_7d5b1a2ac7f2c821: function () {
			return logError(function (arg0) {
				const ret = arg0.body;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_call_9c758de292015997: function () {
			return handleError(function (arg0, arg1, arg2) {
				const ret = arg0.call(arg1, arg2);
				return ret;
			}, arguments);
		},
		__wbg_checked_08fc50bf12676638: function () {
			return logError(function (arg0) {
				const ret = arg0.checked;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_children_9ae5baa88ab73d20: function () {
			return logError(function (arg0) {
				const ret = arg0.children;
				return ret;
			}, arguments);
		},
		__wbg_disabled_1ba557c599ff8239: function () {
			return logError(function (arg0) {
				const ret = arg0.disabled;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_disabled_5f5a2fdd97589f72: function () {
			return logError(function (arg0) {
				const ret = arg0.disabled;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_disabled_a87e032112d0b1cb: function () {
			return logError(function (arg0) {
				const ret = arg0.disabled;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_disabled_c5c0ca44b7eab049: function () {
			return logError(function (arg0) {
				const ret = arg0.disabled;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_document_aceb08cd6489baf5: function () {
			return logError(function (arg0) {
				const ret = arg0.document;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_error_7a86b9285ff1f3b7: function () {
			return logError(function (arg0, arg1) {
				console.error(getStringFromWasm0(arg0, arg1));
			}, arguments);
		},
		__wbg_getAttribute_27f7a0d74339fd41: function () {
			return logError(function (arg0, arg1, arg2, arg3) {
				const ret = arg1.getAttribute(getStringFromWasm0(arg2, arg3));
				var ptr1 = isLikeNone(ret)
					? 0
					: passStringToWasm0(
							ret,
							wasm.__wbindgen_malloc,
							wasm.__wbindgen_realloc,
						);
				var len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_getBoundingClientRect_93c2750834277567: function () {
			return logError(function (arg0) {
				const ret = arg0.getBoundingClientRect();
				return ret;
			}, arguments);
		},
		__wbg_getComputedStyle_c59f58a15bc6a800: function () {
			return handleError(function (arg0, arg1) {
				const ret = arg0.getComputedStyle(arg1);
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_getElementById_c35b4b7d270d161d: function () {
			return logError(function (arg0, arg1, arg2) {
				const ret = arg0.getElementById(getStringFromWasm0(arg1, arg2));
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_getPropertyValue_dbbb77f232017e4d: function () {
			return handleError(function (arg0, arg1, arg2, arg3) {
				const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_hasAttribute_8a0e80dea64a024f: function () {
			return logError(function (arg0, arg1, arg2) {
				const ret = arg0.hasAttribute(getStringFromWasm0(arg1, arg2));
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_height_8e3b6ac1a60655fb: function () {
			return logError(function (arg0) {
				const ret = arg0.height;
				return ret;
			}, arguments);
		},
		__wbg_inert_0bd91a1cdd1e743d: function () {
			return logError(function (arg0) {
				const ret = arg0.inert;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_innerHeight_8b6ee2571dbedb9d: function () {
			return handleError(function (arg0) {
				const ret = arg0.innerHeight;
				return ret;
			}, arguments);
		},
		__wbg_innerWidth_7475bec19f48fe43: function () {
			return handleError(function (arg0) {
				const ret = arg0.innerWidth;
				return ret;
			}, arguments);
		},
		__wbg_instanceof_Element_73566cb5986eac3a: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof Element;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlButtonElement_50af3d9222be97df: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLButtonElement;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlCollection_c16160759bef4bb4: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLCollection;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlElement_9d326f7a42217802: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLElement;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlInputElement_684a7e5d7dbec24c: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLInputElement;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlSelectElement_9678e03521a565e0: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLSelectElement;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_HtmlTextAreaElement_ddb0b111033391f4: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof HTMLTextAreaElement;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_instanceof_Window_e093be59ee9a8e14: function () {
			return logError(function (arg0) {
				let result;
				try {
					result = arg0 instanceof Window;
				} catch (_) {
					result = false;
				}
				const ret = result;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_is_4801976d24bcae5b: function () {
			return logError(function (arg0, arg1) {
				const ret = Object.is(arg0, arg1);
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_item_d4f14947933118b1: function () {
			return logError(function (arg0, arg1) {
				const ret = arg0.item(arg1 >>> 0);
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_length_9cc89ffd1c1c86d1: function () {
			return logError(function (arg0) {
				const ret = arg0.length;
				_assertNum(ret);
				return ret;
			}, arguments);
		},
		__wbg_log_4216cc9a0cabcdb5: function () {
			return logError(function (arg0, arg1) {
				console.log(getStringFromWasm0(arg0, arg1));
			}, arguments);
		},
		__wbg_log_cf2e968649f3384e: function () {
			return logError(function (arg0) {
				console.log(arg0);
			}, arguments);
		},
		__wbg_new_typed_bf31d18f92484486: function () {
			return logError(function (arg0, arg1) {
				try {
					var state0 = { a: arg0, b: arg1 };
					var cb0 = (arg0, arg1) => {
						const a = state0.a;
						state0.a = 0;
						try {
							return wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
								a,
								state0.b,
								arg0,
								arg1,
							);
						} finally {
							state0.a = a;
						}
					};
					const ret = new Promise(cb0);
					return ret;
				} finally {
					state0.a = 0;
				}
			}, arguments);
		},
		__wbg_parentNode_6ee3190f9ba96b9b: function () {
			return logError(function (arg0) {
				const ret = arg0.parentNode;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_parse_03863847d06c4e89: function () {
			return handleError(function (arg0, arg1) {
				const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
				return ret;
			}, arguments);
		},
		__wbg_querySelector_6f6509bf1f8f4753: function () {
			return handleError(function (arg0, arg1, arg2) {
				const ret = arg0.querySelector(getStringFromWasm0(arg1, arg2));
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_queueMicrotask_35c611f4a14830b2: function () {
			return logError(function (arg0) {
				queueMicrotask(arg0);
			}, arguments);
		},
		__wbg_queueMicrotask_404ed0a58e0b63cc: function () {
			return logError(function (arg0) {
				const ret = arg0.queueMicrotask;
				return ret;
			}, arguments);
		},
		__wbg_readOnly_13f0673887c3c745: function () {
			return logError(function (arg0) {
				const ret = arg0.readOnly;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_readOnly_44fbbbcbaa1d1a39: function () {
			return logError(function (arg0) {
				const ret = arg0.readOnly;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_required_02bbd48afeda04dc: function () {
			return logError(function (arg0) {
				const ret = arg0.required;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_required_a36726a26c3b38d4: function () {
			return logError(function (arg0) {
				const ret = arg0.required;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_required_c0738fcb4fab320c: function () {
			return logError(function (arg0) {
				const ret = arg0.required;
				_assertBoolean(ret);
				return ret;
			}, arguments);
		},
		__wbg_resolve_25a7e548d5881dca: function () {
			return logError(function (arg0) {
				const ret = Promise.resolve(arg0);
				return ret;
			}, arguments);
		},
		__wbg_run_322bf7e1760605e9: function () {
			return logError(function (arg0, arg1, arg2) {
				try {
					var state0 = { a: arg1, b: arg2 };
					var cb0 = () => {
						const a = state0.a;
						state0.a = 0;
						try {
							return wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
								a,
								state0.b,
							);
						} finally {
							state0.a = a;
						}
					};
					const ret = arg0.run(cb0);
					_assertBoolean(ret);
					return ret;
				} finally {
					state0.a = 0;
				}
			}, arguments);
		},
		__wbg_scrollX_9c3fa310cb5ed346: function () {
			return handleError(function (arg0) {
				const ret = arg0.scrollX;
				return ret;
			}, arguments);
		},
		__wbg_scrollY_5502bd75aa44fd39: function () {
			return handleError(function (arg0) {
				const ret = arg0.scrollY;
				return ret;
			}, arguments);
		},
		__wbg_setAttribute_5b695d1c3be2e3e6: function () {
			return handleError(function (arg0, arg1, arg2, arg3, arg4) {
				arg0.setAttribute(
					getStringFromWasm0(arg1, arg2),
					getStringFromWasm0(arg3, arg4),
				);
			}, arguments);
		},
		__wbg_static_accessor_CREATE_TASK_b6a4b7f987c70792: function () {
			return logError(function () {
				const ret = typeof console === "undefined" ? null : console?.createTask;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function () {
			return logError(function () {
				const ret = typeof global === "undefined" ? null : global;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function () {
			return logError(function () {
				const ret = typeof globalThis === "undefined" ? null : globalThis;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_static_accessor_SELF_4c59f6c7ea29a144: function () {
			return logError(function () {
				const ret = typeof self === "undefined" ? null : self;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_static_accessor_WINDOW_e70ae9f2eb052253: function () {
			return logError(function () {
				const ret = typeof window === "undefined" ? null : window;
				return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
			}, arguments);
		},
		__wbg_stringify_8286df6dcc591521: function () {
			return handleError(function (arg0) {
				const ret = JSON.stringify(arg0);
				return ret;
			}, arguments);
		},
		__wbg_tabIndex_e7c1633f01c9cd5a: function () {
			return logError(function (arg0) {
				const ret = arg0.tabIndex;
				_assertNum(ret);
				return ret;
			}, arguments);
		},
		__wbg_tagName_45bb7a95d4c5377b: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.tagName;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_textContent_666b896f07901078: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.textContent;
				var ptr1 = isLikeNone(ret)
					? 0
					: passStringToWasm0(
							ret,
							wasm.__wbindgen_malloc,
							wasm.__wbindgen_realloc,
						);
				var len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_then_18f476d590e58992: function () {
			return logError(function (arg0, arg1, arg2) {
				const ret = arg0.then(arg1, arg2);
				return ret;
			}, arguments);
		},
		__wbg_then_ac7b025999b52837: function () {
			return logError(function (arg0, arg1) {
				const ret = arg0.then(arg1);
				return ret;
			}, arguments);
		},
		__wbg_title_42afd6249a172b6d: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.title;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_value_32493aa1c785ef7c: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.value;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_value_6177c7953f900695: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.value;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_value_ed244ce0aafd9d66: function () {
			return logError(function (arg0, arg1) {
				const ret = arg1.value;
				const ptr1 = passStringToWasm0(
					ret,
					wasm.__wbindgen_malloc,
					wasm.__wbindgen_realloc,
				);
				const len1 = WASM_VECTOR_LEN;
				getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
				getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
			}, arguments);
		},
		__wbg_width_1e0b74fef17bc28b: function () {
			return logError(function (arg0) {
				const ret = arg0.width;
				return ret;
			}, arguments);
		},
		__wbg_x_e64ab23f42714230: function () {
			return logError(function (arg0) {
				const ret = arg0.x;
				return ret;
			}, arguments);
		},
		__wbg_y_c4a34029ac91ece3: function () {
			return logError(function (arg0) {
				const ret = arg0.y;
				return ret;
			}, arguments);
		},
		__wbindgen_cast_0000000000000001: function () {
			return logError(function (arg0, arg1) {
				// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 682, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
				const ret = makeMutClosure(
					arg0,
					arg1,
					wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db,
				);
				return ret;
			}, arguments);
		},
		__wbindgen_cast_0000000000000002: function () {
			return logError(function (arg0, arg1) {
				// Cast intrinsic for `Ref(String) -> Externref`.
				const ret = getStringFromWasm0(arg0, arg1);
				return ret;
			}, arguments);
		},
		__wbindgen_init_externref_table: function () {
			const table = wasm.__wbindgen_externrefs;
			const offset = table.grow(4);
			table.set(0, undefined);
			table.set(offset + 0, undefined);
			table.set(offset + 1, null);
			table.set(offset + 2, true);
			table.set(offset + 3, false);
		},
	};
	return {
		__proto__: null,
		"./extension_js_bg.js": import0,
		env: import1,
		env: import2,
		env: import3,
		env: import4,
		env: import5,
		env: import6,
		env: import7,
		env: import8,
		env: import9,
		env: import10,
		env: import11,
		env: import12,
		env: import13,
		env: import14,
		env: import15,
		env: import16,
		env: import17,
		env: import18,
		env: import19,
		env: import20,
		env: import21,
		env: import22,
		env: import23,
		env: import24,
		env: import25,
		env: import26,
		env: import27,
		env: import28,
		env: import29,
		env: import30,
		env: import31,
	};
}

//#endregion
function wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
	arg0,
	arg1,
) {
	_assertNum(arg0);
	_assertNum(arg1);
	const ret =
		wasm.wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
			arg0,
			arg1,
		);
	return ret !== 0;
}

function wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db(
	arg0,
	arg1,
	arg2,
) {
	_assertNum(arg0);
	_assertNum(arg1);
	const ret =
		wasm.wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db(
			arg0,
			arg1,
			arg2,
		);
	if (ret[1]) {
		throw takeFromExternrefTable0(ret[0]);
	}
}

function wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
	arg0,
	arg1,
	arg2,
	arg3,
) {
	_assertNum(arg0);
	_assertNum(arg1);
	wasm.wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
		arg0,
		arg1,
		arg2,
		arg3,
	);
}

const ExtensionSessionFinalization =
	typeof FinalizationRegistry === "undefined"
		? { register: () => {}, unregister: () => {} }
		: new FinalizationRegistry((ptr) =>
				wasm.__wbg_extensionsession_free(ptr, 1),
			);

//#region intrinsics
function addToExternrefTable0(obj) {
	const idx = wasm.__externref_table_alloc();
	wasm.__wbindgen_externrefs.set(idx, obj);
	return idx;
}

function _assertBoolean(n) {
	if (typeof n !== "boolean") {
		throw new Error(`expected a boolean argument, found ${typeof n}`);
	}
}

function _assertNum(n) {
	if (typeof n !== "number")
		throw new Error(`expected a number argument, found ${typeof n}`);
}

const CLOSURE_DTORS =
	typeof FinalizationRegistry === "undefined"
		? { register: () => {}, unregister: () => {} }
		: new FinalizationRegistry((state) =>
				wasm.__wbindgen_destroy_closure(state.a, state.b),
			);

function debugString(val) {
	// primitive types
	const type = typeof val;
	if (type == "number" || type == "boolean" || val == null) {
		return `${val}`;
	}
	if (type == "string") {
		return `"${val}"`;
	}
	if (type == "symbol") {
		const description = val.description;
		if (description == null) {
			return "Symbol";
		} else {
			return `Symbol(${description})`;
		}
	}
	if (type == "function") {
		const name = val.name;
		if (typeof name == "string" && name.length > 0) {
			return `Function(${name})`;
		} else {
			return "Function";
		}
	}
	// objects
	if (Array.isArray(val)) {
		const length = val.length;
		let debug = "[";
		if (length > 0) {
			debug += debugString(val[0]);
		}
		for (let i = 1; i < length; i++) {
			debug += ", " + debugString(val[i]);
		}
		debug += "]";
		return debug;
	}
	// Test for built-in
	const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
	let className;
	if (builtInMatches && builtInMatches.length > 1) {
		className = builtInMatches[1];
	} else {
		// Failed to match the standard '[object ClassName]'
		return toString.call(val);
	}
	if (className == "Object") {
		// we're a user defined class or Object
		// JSON.stringify avoids problems with cycles, and is generally much
		// easier than looping through ownProperties of `val`.
		try {
			return "Object(" + JSON.stringify(val) + ")";
		} catch (_) {
			return "Object";
		}
	}
	// errors
	if (val instanceof Error) {
		return `${val.name}: ${val.message}\n${val.stack}`;
	}
	// TODO we could test for more things here, like `Set`s and `Map`s.
	return className;
}

let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
	if (
		cachedDataViewMemory0 === null ||
		cachedDataViewMemory0.buffer.detached === true ||
		(cachedDataViewMemory0.buffer.detached === undefined &&
			cachedDataViewMemory0.buffer !== wasm.memory.buffer)
	) {
		cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
	}
	return cachedDataViewMemory0;
}

function getStringFromWasm0(ptr, len) {
	return decodeText(ptr >>> 0, len);
}

let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
	if (
		cachedUint8ArrayMemory0 === null ||
		cachedUint8ArrayMemory0.byteLength === 0
	) {
		cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
	}
	return cachedUint8ArrayMemory0;
}

function handleError(f, args) {
	try {
		return f.apply(this, args);
	} catch (e) {
		const idx = addToExternrefTable0(e);
		wasm.__wbindgen_exn_store(idx);
	}
}

function isLikeNone(x) {
	return x === undefined || x === null;
}

function logError(f, args) {
	try {
		return f.apply(this, args);
	} catch (e) {
		let error = (function () {
			try {
				return e instanceof Error
					? `${e.message}\n\nStack:\n${e.stack}`
					: e.toString();
			} catch (_) {
				return "<failed to stringify thrown value>";
			}
		})();
		console.error(
			"wasm-bindgen: imported JS function that was not marked as `catch` threw an error:",
			error,
		);
		throw e;
	}
}

function makeMutClosure(arg0, arg1, f) {
	const state = { a: arg0, b: arg1, cnt: 1 };
	const real = (...args) => {
		// First up with a closure we increment the internal reference
		// count. This ensures that the Rust closure environment won't
		// be deallocated while we're invoking it.
		state.cnt++;
		const a = state.a;
		state.a = 0;
		try {
			return f(a, state.b, ...args);
		} finally {
			state.a = a;
			real._wbg_cb_unref();
		}
	};
	real._wbg_cb_unref = () => {
		if (--state.cnt === 0) {
			wasm.__wbindgen_destroy_closure(state.a, state.b);
			state.a = 0;
			CLOSURE_DTORS.unregister(state);
		}
	};
	CLOSURE_DTORS.register(real, state, state);
	return real;
}

function passStringToWasm0(arg, malloc, realloc) {
	if (typeof arg !== "string")
		throw new Error(`expected a string argument, found ${typeof arg}`);
	if (realloc === undefined) {
		const buf = cachedTextEncoder.encode(arg);
		const ptr = malloc(buf.length, 1) >>> 0;
		getUint8ArrayMemory0()
			.subarray(ptr, ptr + buf.length)
			.set(buf);
		WASM_VECTOR_LEN = buf.length;
		return ptr;
	}

	let len = arg.length;
	let ptr = malloc(len, 1) >>> 0;

	const mem = getUint8ArrayMemory0();

	let offset = 0;

	for (; offset < len; offset++) {
		const code = arg.charCodeAt(offset);
		if (code > 0x7f) break;
		mem[ptr + offset] = code;
	}
	if (offset !== len) {
		if (offset !== 0) {
			arg = arg.slice(offset);
		}
		ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
		const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
		const ret = cachedTextEncoder.encodeInto(arg, view);
		if (ret.read !== arg.length) throw new Error("failed to pass whole string");
		offset += ret.written;
		ptr = realloc(ptr, len, offset, 1) >>> 0;
	}

	WASM_VECTOR_LEN = offset;
	return ptr;
}

function takeFromExternrefTable0(idx) {
	const value = wasm.__wbindgen_externrefs.get(idx);
	wasm.__externref_table_dealloc(idx);
	return value;
}

let cachedTextDecoder = new TextDecoder("utf-8", {
	ignoreBOM: true,
	fatal: true,
});
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
	numBytesDecoded += len;
	if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
		cachedTextDecoder = new TextDecoder("utf-8", {
			ignoreBOM: true,
			fatal: true,
		});
		cachedTextDecoder.decode();
		numBytesDecoded = len;
	}
	return cachedTextDecoder.decode(
		getUint8ArrayMemory0().subarray(ptr, ptr + len),
	);
}

const cachedTextEncoder = new TextEncoder();

if (!("encodeInto" in cachedTextEncoder)) {
	cachedTextEncoder.encodeInto = function (arg, view) {
		const buf = cachedTextEncoder.encode(arg);
		view.set(buf);
		return {
			read: arg.length,
			written: buf.length,
		};
	};
}

let WASM_VECTOR_LEN = 0;

//#endregion

//#region wasm loading
let wasmModule, wasmInstance, wasm;
function __wbg_finalize_init(instance, module) {
	wasmInstance = instance;
	wasm = instance.exports;
	wasmModule = module;
	cachedDataViewMemory0 = null;
	cachedUint8ArrayMemory0 = null;
	wasm.__wbindgen_start();
	return wasm;
}

async function __wbg_load(module, imports) {
	if (typeof Response === "function" && module instanceof Response) {
		if (typeof WebAssembly.instantiateStreaming === "function") {
			try {
				return await WebAssembly.instantiateStreaming(module, imports);
			} catch (e) {
				const validResponse = module.ok && expectedResponseType(module.type);

				if (
					validResponse &&
					module.headers.get("Content-Type") !== "application/wasm"
				) {
					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,
					);
				} else {
					throw e;
				}
			}
		}

		const bytes = await module.arrayBuffer();
		return await WebAssembly.instantiate(bytes, imports);
	} else {
		const instance = await WebAssembly.instantiate(module, imports);

		if (instance instanceof WebAssembly.Instance) {
			return { instance, module };
		} else {
			return instance;
		}
	}

	function expectedResponseType(type) {
		switch (type) {
			case "basic":
			case "cors":
			case "default":
				return true;
		}
		return false;
	}
}

function initSync(module) {
	if (wasm !== undefined) return wasm;

	if (module !== undefined) {
		if (Object.getPrototypeOf(module) === Object.prototype) {
			({ module } = module);
		} else {
			console.warn(
				"using deprecated parameters for `initSync()`; pass a single object instead",
			);
		}
	}

	const imports = __wbg_get_imports();
	if (!(module instanceof WebAssembly.Module)) {
		module = new WebAssembly.Module(module);
	}
	const instance = new WebAssembly.Instance(module, imports);
	return __wbg_finalize_init(instance, module);
}

async function __wbg_init(module_or_path) {
	if (wasm !== undefined) return wasm;

	if (module_or_path !== undefined) {
		if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
			({ module_or_path } = module_or_path);
		} else {
			console.warn(
				"using deprecated parameters for the initialization function; pass a single object instead",
			);
		}
	}

	if (module_or_path === undefined) {
		module_or_path = new URL("extension_js_bg.wasm", import.meta.url);
	}
	const imports = __wbg_get_imports();

	if (
		typeof module_or_path === "string" ||
		(typeof Request === "function" && module_or_path instanceof Request) ||
		(typeof URL === "function" && module_or_path instanceof URL)
	) {
		module_or_path = fetch(module_or_path);
	}

	const { instance, module } = await __wbg_load(await module_or_path, imports);

	return __wbg_finalize_init(instance, module);
}

export { initSync, __wbg_init as default };
//#endregion
export { wasm as __wasm };
