CoolFace
Apppublic

Nymbo/self-hosted-python

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes
pyodide.mjs.map1 linesDownload Raw Back to root
1{"version":3,"file":"pyodide.mjs","sources":["../src/js/module.js","../src/js/load-pyodide.js","../src/js/pyproxy.gen.js","../src/js/api.js","../src/js/pyodide.js"],"sourcesContent":["/**\n * @typedef {import('emscripten').Module} Module\n */\n\n/**\n * The Emscripten Module.\n *\n * @private\n * @type {Module}\n */\nexport let Module = {};\nModule.noImageDecoding = true;\nModule.noAudioDecoding = true;\nModule.noWasmDecoding = false; // we preload wasm using the built in plugin now\nModule.preloadedWasm = {};\nModule.preRun = [];\n\n/**\n *\n * @param {undefined | function(): string} stdin\n * @param {undefined | function(string)} stdout\n * @param {undefined | function(string)} stderr\n * @private\n */\nexport function setStandardStreams(stdin, stdout, stderr) {\n  // For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string\n  if (stdout) {\n    Module.print = stdout;\n  }\n\n  if (stderr) {\n    Module.printErr = stderr;\n  }\n\n  // For stdin, we have to deal with the low level API ourselves\n  if (stdin) {\n    Module.preRun.push(function () {\n      Module.FS.init(createStdinWrapper(stdin), null, null);\n    });\n  }\n}\n\nfunction createStdinWrapper(stdin) {\n  // When called, it asks the user for one whole line of input (stdin)\n  // Then, it passes the individual bytes of the input to emscripten, one after another.\n  // And finally, it terminates it with null.\n  const encoder = new TextEncoder();\n  let input = new Uint8Array(0);\n  let inputIndex = -1; // -1 means that we just returned null\n  function stdinWrapper() {\n    try {\n      if (inputIndex === -1) {\n        let text = stdin();\n        if (text === undefined || text === null) {\n          return null;\n        }\n        if (typeof text !== \"string\") {\n          throw new TypeError(\n            `Expected stdin to return string, null, or undefined, got type ${typeof text}.`\n          );\n        }\n        if (!text.endsWith(\"\\n\")) {\n          text += \"\\n\";\n        }\n        input = encoder.encode(text);\n        inputIndex = 0;\n      }\n\n      if (inputIndex < input.length) {\n        let character = input[inputIndex];\n        inputIndex++;\n        return character;\n      } else {\n        inputIndex = -1;\n        return null;\n      }\n    } catch (e) {\n      // emscripten will catch this and set an IOError which is unhelpful for\n      // debugging.\n      console.error(\"Error thrown in stdin:\");\n      console.error(e);\n      throw e;\n    }\n  }\n  return stdinWrapper;\n}\n\n/**\n * Make the home directory inside the virtual file system,\n * then change the working directory to it.\n *\n * @param {string} path\n * @private\n */\nexport function setHomeDirectory(path) {\n  Module.preRun.push(function () {\n    const fallbackPath = \"/\";\n    try {\n      Module.FS.mkdirTree(path);\n    } catch (e) {\n      console.error(`Error occurred while making a home directory '${path}':`);\n      console.error(e);\n      console.error(`Using '${fallbackPath}' for a home directory instead`);\n      path = fallbackPath;\n    }\n    Module.ENV.HOME = path;\n    Module.FS.chdir(path);\n  });\n}\n","import { Module } from \"./module.js\";\n\nconst IN_NODE =\n  typeof process !== \"undefined\" &&\n  process.release &&\n  process.release.name === \"node\" &&\n  typeof process.browser ===\n    \"undefined\"; /* This last condition checks if we run the browser shim of process */\n\n/** @typedef {import('./pyproxy.js').PyProxy} PyProxy */\n/** @private */\nlet baseURL;\n/**\n * @param {string} indexURL\n * @private\n */\nexport async function initializePackageIndex(indexURL) {\n  baseURL = indexURL;\n  let package_json;\n  if (IN_NODE) {\n    const fsPromises = await import(/* webpackIgnore: true */ \"fs/promises\");\n    const package_string = await fsPromises.readFile(\n      `${indexURL}packages.json`\n    );\n    package_json = JSON.parse(package_string);\n  } else {\n    let response = await fetch(`${indexURL}packages.json`);\n    package_json = await response.json();\n  }\n  if (!package_json.packages) {\n    throw new Error(\n      \"Loaded packages.json does not contain the expected key 'packages'.\"\n    );\n  }\n  Module.packages = package_json.packages;\n\n  // compute the inverted index for imports to package names\n  Module._import_name_to_package_name = new Map();\n  for (let name of Object.keys(Module.packages)) {\n    for (let import_name of Module.packages[name].imports) {\n      Module._import_name_to_package_name.set(import_name, name);\n    }\n  }\n}\n\nexport async function _fetchBinaryFile(indexURL, path) {\n  if (IN_NODE) {\n    const fsPromises = await import(/* webpackIgnore: true */ \"fs/promises\");\n    const tar_buffer = await fsPromises.readFile(`${indexURL}${path}`);\n    return tar_buffer.buffer;\n  } else {\n    let response = await fetch(`${indexURL}${path}`);\n    return await response.arrayBuffer();\n  }\n}\n\n////////////////////////////////////////////////////////////\n// Package loading\nconst DEFAULT_CHANNEL = \"default channel\";\n\n// Regexp for validating package name and URI\nconst package_uri_regexp = /^.*?([^\\/]*)\\.js$/;\n\nfunction _uri_to_package_name(package_uri) {\n  let match = package_uri_regexp.exec(package_uri);\n  if (match) {\n    return match[1].toLowerCase();\n  }\n}\n\n/**\n * @param {string) url\n * @async\n * @private\n */\nexport let loadScript;\nif (globalThis.document) {\n  // browser\n  loadScript = async (url) => await import(/* webpackIgnore: true */ url);\n} else if (globalThis.importScripts) {\n  // webworker\n  loadScript = async (url) => {\n    // This is async only for consistency\n    globalThis.importScripts(url);\n  };\n} else if (IN_NODE) {\n  const pathPromise = import(/* webpackIgnore: true */ \"path\").then(\n    (M) => M.default\n  );\n  const fetchPromise = import(\"node-fetch\").then((M) => M.default);\n  const vmPromise = import(/* webpackIgnore: true */ \"vm\").then(\n    (M) => M.default\n  );\n  loadScript = async (url) => {\n    if (url.includes(\"://\")) {\n      // If it's a url, have to load it with fetch and then eval it.\n      const fetch = await fetchPromise;\n      const vm = await vmPromise;\n      vm.runInThisContext(await (await fetch(url)).text());\n    } else {\n      // Otherwise, hopefully it is a relative path we can load from the file\n      // system.\n      const path = await pathPromise;\n      await import(path.resolve(url));\n    }\n  };\n} else {\n  throw new Error(\"Cannot determine runtime environment\");\n}\n\nfunction addPackageToLoad(name, toLoad) {\n  name = name.toLowerCase();\n  if (toLoad.has(name)) {\n    return;\n  }\n  toLoad.set(name, DEFAULT_CHANNEL);\n  // If the package is already loaded, we don't add dependencies, but warn\n  // the user later. This is especially important if the loaded package is\n  // from a custom url, in which case adding dependencies is wrong.\n  if (loadedPackages[name] !== undefined) {\n    return;\n  }\n  for (let dep_name of Module.packages[name].depends) {\n    addPackageToLoad(dep_name, toLoad);\n  }\n}\n\nfunction recursiveDependencies(\n  names,\n  _messageCallback,\n  errorCallback,\n  sharedLibsOnly\n) {\n  const toLoad = new Map();\n  for (let name of names) {\n    const pkgname = _uri_to_package_name(name);\n    if (toLoad.has(pkgname) && toLoad.get(pkgname) !== name) {\n      errorCallback(\n        `Loading same package ${pkgname} from ${name} and ${toLoad.get(\n          pkgname\n        )}`\n      );\n      continue;\n    }\n    if (pkgname !== undefined) {\n      toLoad.set(pkgname, name);\n      continue;\n    }\n    name = name.toLowerCase();\n    if (name in Module.packages) {\n      addPackageToLoad(name, toLoad);\n      continue;\n    }\n    errorCallback(`Skipping unknown package '${name}'`);\n  }\n  if (sharedLibsOnly) {\n    let onlySharedLibs = new Map();\n    for (let c of toLoad) {\n      let name = c[0];\n      if (Module.packages[name].shared_library) {\n        onlySharedLibs.set(name, toLoad.get(name));\n      }\n    }\n    return onlySharedLibs;\n  }\n  return toLoad;\n}\n\n// locateFile is the function used by the .js file to locate the .data file\n// given the filename\nModule.locateFile = function (path) {\n  // handle packages loaded from custom URLs\n  let pkg = path.replace(/\\.data$/, \"\");\n  const toLoad = Module.locateFile_packagesToLoad;\n  if (toLoad && toLoad.has(pkg)) {\n    let package_uri = toLoad.get(pkg);\n    if (package_uri != DEFAULT_CHANNEL) {\n      return package_uri.replace(/\\.js$/, \".data\");\n    }\n  }\n  return baseURL + path;\n};\n\n// When the JS loads, it synchronously adds a runDependency to emscripten. It\n// then loads the data file, and removes the runDependency from emscripten.\n// This function returns a promise that resolves when there are no pending\n// runDependencies.\nfunction waitRunDependency() {\n  const promise = new Promise((r) => {\n    Module.monitorRunDependencies = (n) => {\n      if (n === 0) {\n        r();\n      }\n    };\n  });\n  // If there are no pending dependencies left, monitorRunDependencies will\n  // never be called. Since we can't check the number of dependencies,\n  // manually trigger a call.\n  Module.addRunDependency(\"dummy\");\n  Module.removeRunDependency(\"dummy\");\n  return promise;\n}\n\nasync function _loadPackage(names, messageCallback, errorCallback) {\n  // toLoad is a map pkg_name => pkg_uri\n  let toLoad = recursiveDependencies(names, messageCallback, errorCallback);\n  // Tell Module.locateFile about the packages we're loading\n  Module.locateFile_packagesToLoad = toLoad;\n  if (toLoad.size === 0) {\n    return Promise.resolve(\"No new packages to load\");\n  } else {\n    let packageNames = Array.from(toLoad.keys()).join(\", \");\n    messageCallback(`Loading ${packageNames}`);\n  }\n\n  // This is a collection of promises that resolve when the package's JS file is\n  // loaded. The promises already handle error and never fail.\n  let scriptPromises = [];\n\n  for (let [pkg, uri] of toLoad) {\n    let loaded = loadedPackages[pkg];\n    if (loaded !== undefined) {\n      // If uri is from the DEFAULT_CHANNEL, we assume it was added as a\n      // depedency, which was previously overridden.\n      if (loaded === uri || uri === DEFAULT_CHANNEL) {\n        messageCallback(`${pkg} already loaded from ${loaded}`);\n        continue;\n      } else {\n        errorCallback(\n          `URI mismatch, attempting to load package ${pkg} from ${uri} ` +\n            `while it is already loaded from ${loaded}. To override a dependency, ` +\n            `load the custom package first.`\n        );\n        continue;\n      }\n    }\n    let pkgname = (Module.packages[pkg] && Module.packages[pkg].name) || pkg;\n    let scriptSrc = uri === DEFAULT_CHANNEL ? `${baseURL}${pkgname}.js` : uri;\n    messageCallback(`Loading ${pkg} from ${scriptSrc}`);\n    scriptPromises.push(\n      loadScript(scriptSrc).catch((e) => {\n        errorCallback(`Couldn't load package from URL ${scriptSrc}`, e);\n        toLoad.delete(pkg);\n      })\n    );\n  }\n\n  // We must start waiting for runDependencies *after* all the JS files are\n  // loaded, since the number of runDependencies may happen to equal zero\n  // between package files loading.\n  try {\n    await Promise.all(scriptPromises).then(waitRunDependency);\n  } finally {\n    delete Module.monitorRunDependencies;\n  }\n\n  let packageList = [];\n  for (let [pkg, uri] of toLoad) {\n    loadedPackages[pkg] = uri;\n    packageList.push(pkg);\n  }\n\n  let resolveMsg;\n  if (packageList.length > 0) {\n    let packageNames = packageList.join(\", \");\n    resolveMsg = `Loaded ${packageNames}`;\n  } else {\n    resolveMsg = \"No packages loaded\";\n  }\n\n  Module.reportUndefinedSymbols();\n\n  messageCallback(resolveMsg);\n\n  // We have to invalidate Python's import caches, or it won't\n  // see the new files.\n  Module.importlib.invalidate_caches();\n}\n\n// This is a promise that is resolved iff there are no pending package loads. It\n// never fails.\nlet _package_lock = Promise.resolve();\n\n/**\n * An async lock for package loading. Prevents race conditions in loadPackage.\n * @returns A zero argument function that releases the lock.\n * @private\n */\nasync function acquirePackageLock() {\n  let old_lock = _package_lock;\n  let releaseLock;\n  _package_lock = new Promise((resolve) => (releaseLock = resolve));\n  await old_lock;\n  return releaseLock;\n}\n\n/**\n *\n * The list of packages that Pyodide has loaded.\n * Use ``Object.keys(pyodide.loadedPackages)`` to get the list of names of\n * loaded packages, and ``pyodide.loadedPackages[package_name]`` to access\n * install location for a particular ``package_name``.\n *\n * @type {object}\n */\nexport let loadedPackages = {};\n\nlet sharedLibraryWasmPlugin;\nlet origWasmPlugin;\nlet wasmPluginIndex;\nfunction initSharedLibraryWasmPlugin() {\n  for (let p in Module.preloadPlugins) {\n    if (Module.preloadPlugins[p].canHandle(\"test.so\")) {\n      origWasmPlugin = Module.preloadPlugins[p];\n      wasmPluginIndex = p;\n      break;\n    }\n  }\n  sharedLibraryWasmPlugin = {\n    canHandle: origWasmPlugin.canHandle,\n    handle(byteArray, name, onload, onerror) {\n      origWasmPlugin.handle(byteArray, name, onload, onerror);\n      origWasmPlugin.asyncWasmLoadPromise = (async () => {\n        await origWasmPlugin.asyncWasmLoadPromise;\n        Module.loadDynamicLibrary(name, {\n          global: true,\n          nodelete: true,\n        });\n      })();\n    },\n  };\n}\n\n// override the load plugin so that it calls \"Module.loadDynamicLibrary\" on any\n// .so files.\n// this only needs to be done for shared library packages because we assume that\n// if a package depends on a shared library it needs to have access to it. not\n// needed for .so in standard module because those are linked together\n// correctly, it is only where linking goes across modules that it needs to be\n// done. Hence, we only put this extra preload plugin in during the shared\n// library load\nfunction useSharedLibraryWasmPlugin() {\n  if (!sharedLibraryWasmPlugin) {\n    initSharedLibraryWasmPlugin();\n  }\n  Module.preloadPlugins[wasmPluginIndex] = sharedLibraryWasmPlugin;\n}\n\nfunction restoreOrigWasmPlugin() {\n  Module.preloadPlugins[wasmPluginIndex] = origWasmPlugin;\n}\n\n/**\n * @callback LogFn\n * @param {string} msg\n * @returns {void}\n * @private\n */\n\n/**\n * Load a package or a list of packages over the network. This installs the\n * package in the virtual filesystem. The package needs to be imported from\n * Python before it can be used.\n *\n * @param {string | string[] | PyProxy} names Either a single package name or\n * URL or a list of them. URLs can be absolute or relative. The URLs must have\n * file name ``<package-name>.js`` and there must be a file called\n * ``<package-name>.data`` in the same directory. The argument can be a\n * ``PyProxy`` of a list, in which case the list will be converted to JavaScript\n * and the ``PyProxy`` will be destroyed.\n * @param {LogFn=} messageCallback A callback, called with progress messages\n *    (optional)\n * @param {LogFn=} errorCallback A callback, called with error/warning messages\n *    (optional)\n * @async\n */\nexport async function loadPackage(names, messageCallback, errorCallback) {\n  if (Module.isPyProxy(names)) {\n    let temp;\n    try {\n      temp = names.toJs();\n    } finally {\n      names.destroy();\n    }\n    names = temp;\n  }\n\n  if (!Array.isArray(names)) {\n    names = [names];\n  }\n  // get shared library packages and load those first\n  // otherwise bad things happen with linking them in firefox.\n  let sharedLibraryNames = [];\n  try {\n    let sharedLibraryPackagesToLoad = recursiveDependencies(\n      names,\n      messageCallback,\n      errorCallback,\n      true\n    );\n    for (let pkg of sharedLibraryPackagesToLoad) {\n      sharedLibraryNames.push(pkg[0]);\n    }\n  } catch (e) {\n    // do nothing - let the main load throw any errors\n  }\n\n  let releaseLock = await acquirePackageLock();\n  try {\n    useSharedLibraryWasmPlugin();\n    await _loadPackage(\n      sharedLibraryNames,\n      messageCallback || console.log,\n      errorCallback || console.error\n    );\n    restoreOrigWasmPlugin();\n    await _loadPackage(\n      names,\n      messageCallback || console.log,\n      errorCallback || console.error\n    );\n  } finally {\n    restoreOrigWasmPlugin();\n    releaseLock();\n  }\n}\n","// This file is generated by applying the C preprocessor to core/pyproxy.js\n// It uses the macros defined in core/pyproxy.c\n// Do not edit it directly!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Every public Python entrypoint goes through this file! The main entrypoint is\n * the callPyObject method, but of course one can also execute arbitrary code\n * via the various __dundermethods__ associated to classes.\n *\n * Any time we call into wasm, the call should be wrapped in a try catch block.\n * This way if a JavaScript error emerges from the wasm, we can escalate it to a\n * fatal error.\n *\n * This is file is preprocessed with -imacros \"pyproxy.c\". As a result of this,\n * any macros available in pyproxy.c are available here. We only need the flags\n * macros HAS_LENGTH, etc.\n *\n * See Makefile recipe for src/js/pyproxy.js\n */\n\nimport { Module } from \"./module.js\";\n\n/**\n * Is the argument a :any:`PyProxy`?\n * @param jsobj {any} Object to test.\n * @returns {jsobj is PyProxy} Is ``jsobj`` a :any:`PyProxy`?\n */\nexport function isPyProxy(jsobj) {\n  return !!jsobj && jsobj.$$ !== undefined && jsobj.$$.type === \"PyProxy\";\n}\nModule.isPyProxy = isPyProxy;\n\nif (globalThis.FinalizationRegistry) {\n  Module.finalizationRegistry = new FinalizationRegistry(([ptr, cache]) => {\n    cache.leaked = (!!1);\n    pyproxy_decref_cache(cache);\n    try {\n      Module._Py_DecRef(ptr);\n    } catch (e) {\n      // I'm not really sure what happens if an error occurs inside of a\n      // finalizer...\n      Module.fatal_error(e);\n    }\n  });\n  // For some unclear reason this code screws up selenium FirefoxDriver. Works\n  // fine in chrome and when I test it in browser. It seems to be sensitive to\n  // changes that don't make a difference to the semantics.\n  // TODO: after 0.18.0, fix selenium issues with this code.\n  // Module.bufferFinalizationRegistry = new FinalizationRegistry((ptr) => {\n  //   try {\n  //     Module._PyBuffer_Release(ptr);\n  //     Module._PyMem_Free(ptr);\n  //   } catch (e) {\n  //     Module.fatal_error(e);\n  //   }\n  // });\n} else {\n  Module.finalizationRegistry = { register() {}, unregister() {} };\n  // Module.bufferFinalizationRegistry = finalizationRegistry;\n}\n\nlet pyproxy_alloc_map = new Map();\nModule.pyproxy_alloc_map = pyproxy_alloc_map;\nlet trace_pyproxy_alloc;\nlet trace_pyproxy_dealloc;\n\nModule.enable_pyproxy_allocation_tracing = function () {\n  trace_pyproxy_alloc = function (proxy) {\n    pyproxy_alloc_map.set(proxy, Error().stack);\n  };\n  trace_pyproxy_dealloc = function (proxy) {\n    pyproxy_alloc_map.delete(proxy);\n  };\n};\nModule.disable_pyproxy_allocation_tracing = function () {\n  trace_pyproxy_alloc = function (proxy) {};\n  trace_pyproxy_dealloc = function (proxy) {};\n};\nModule.disable_pyproxy_allocation_tracing();\n\n/**\n * Create a new PyProxy wraping ptrobj which is a PyObject*.\n *\n * The argument cache is only needed to implement the PyProxy.copy API, it\n * allows the copy of the PyProxy to share its attribute cache with the original\n * version. In all other cases, pyproxy_new should be called with one argument.\n *\n * In the case that the Python object is callable, PyProxyClass inherits from\n * Function so that PyProxy objects can be callable. In that case we MUST expose\n * certain properties inherited from Function, but we do our best to remove as\n * many as possible.\n * @private\n */\nModule.pyproxy_new = function (ptrobj, cache) {\n  let flags = Module._pyproxy_getflags(ptrobj);\n  let cls = Module.getPyProxyClass(flags);\n  // Reflect.construct calls the constructor of Module.PyProxyClass but sets\n  // the prototype as cls.prototype. This gives us a way to dynamically create\n  // subclasses of PyProxyClass (as long as we don't need to use the \"new\n  // cls(ptrobj)\" syntax).\n  let target;\n  if (flags & (1 << 8)) {\n    // To make a callable proxy, we must call the Function constructor.\n    // In this case we are effectively subclassing Function.\n    target = Reflect.construct(Function, [], cls);\n    // Remove undesirable properties added by Function constructor. Note: we\n    // can't remove \"arguments\" or \"caller\" because they are not configurable\n    // and not writable\n    delete target.length;\n    delete target.name;\n    // prototype isn't configurable so we can't delete it but it's writable.\n    target.prototype = undefined;\n  } else {\n    target = Object.create(cls.prototype);\n  }\n  if (!cache) {\n    // The cache needs to be accessed primarily from the C function\n    // _pyproxy_getattr so we make a hiwire id.\n    let cacheId = Module.hiwire.new_value(new Map());\n    cache = { cacheId, refcnt: 0 };\n  }\n  cache.refcnt++;\n  Object.defineProperty(target, \"$$\", {\n    value: { ptr: ptrobj, type: \"PyProxy\", cache },\n  });\n  Module._Py_IncRef(ptrobj);\n  let proxy = new Proxy(target, PyProxyHandlers);\n  trace_pyproxy_alloc(proxy);\n  Module.finalizationRegistry.register(proxy, [ptrobj, cache], proxy);\n  return proxy;\n};\n\nfunction _getPtr(jsobj) {\n  let ptr = jsobj.$$.ptr;\n  if (ptr === null) {\n    throw new Error(jsobj.$$.destroyed_msg);\n  }\n  return ptr;\n}\n\nlet pyproxyClassMap = new Map();\n/**\n * Retreive the appropriate mixins based on the features requested in flags.\n * Used by pyproxy_new. The \"flags\" variable is produced by the C function\n * pyproxy_getflags. Multiple PyProxies with the same set of feature flags\n * will share the same prototype, so the memory footprint of each individual\n * PyProxy is minimal.\n * @private\n */\nModule.getPyProxyClass = function (flags) {\n  let result = pyproxyClassMap.get(flags);\n  if (result) {\n    return result;\n  }\n  let descriptors = {};\n  for (let [feature_flag, methods] of [\n    [(1 << 0), PyProxyLengthMethods],\n    [(1 << 1), PyProxyGetItemMethods],\n    [(1 << 2), PyProxySetItemMethods],\n    [(1 << 3), PyProxyContainsMethods],\n    [(1 << 4), PyProxyIterableMethods],\n    [(1 << 5), PyProxyIteratorMethods],\n    [(1 << 6), PyProxyAwaitableMethods],\n    [(1 << 7), PyProxyBufferMethods],\n    [(1 << 8), PyProxyCallableMethods],\n  ]) {\n    if (flags & feature_flag) {\n      Object.assign(\n        descriptors,\n        Object.getOwnPropertyDescriptors(methods.prototype)\n      );\n    }\n  }\n  // Use base constructor (just throws an error if construction is attempted).\n  descriptors.constructor = Object.getOwnPropertyDescriptor(\n    PyProxyClass.prototype,\n    \"constructor\"\n  );\n  Object.assign(\n    descriptors,\n    Object.getOwnPropertyDescriptors({ $$flags: flags })\n  );\n  let new_proto = Object.create(PyProxyClass.prototype, descriptors);\n  function NewPyProxyClass() {}\n  NewPyProxyClass.prototype = new_proto;\n  pyproxyClassMap.set(flags, NewPyProxyClass);\n  return NewPyProxyClass;\n};\n\n// Static methods\nModule.PyProxy_getPtr = _getPtr;\n\nconst pyproxy_cache_destroyed_msg =\n  \"This borrowed attribute proxy was automatically destroyed in the \" +\n  \"process of destroying the proxy it was borrowed from. Try using the 'copy' method.\";\n\nfunction pyproxy_decref_cache(cache) {\n  if (!cache) {\n    return;\n  }\n  cache.refcnt--;\n  if (cache.refcnt === 0) {\n    let cache_map = Module.hiwire.pop_value(cache.cacheId);\n    for (let proxy_id of cache_map.values()) {\n      const cache_entry = Module.hiwire.pop_value(proxy_id);\n      if (!cache.leaked) {\n        Module.pyproxy_destroy(cache_entry, pyproxy_cache_destroyed_msg);\n      }\n    }\n  }\n}\n\nModule.pyproxy_destroy = function (proxy, destroyed_msg) {\n  if (proxy.$$.ptr === null) {\n    return;\n  }\n  let ptrobj = _getPtr(proxy);\n  Module.finalizationRegistry.unregister(proxy);\n  destroyed_msg = destroyed_msg || \"Object has already been destroyed\";\n  let proxy_type = proxy.type;\n  let proxy_repr;\n  try {\n    proxy_repr = proxy.toString();\n  } catch (e) {\n    if (e.pyodide_fatal_error) {\n      throw e;\n    }\n  }\n  // Maybe the destructor will call JavaScript code that will somehow try\n  // to use this proxy. Mark it deleted before decrementing reference count\n  // just in case!\n  proxy.$$.ptr = null;\n  destroyed_msg += \"\\n\" + `The object was of type \"${proxy_type}\" and `;\n  if (proxy_repr) {\n    destroyed_msg += `had repr \"${proxy_repr}\"`;\n  } else {\n    destroyed_msg += \"an error was raised when trying to generate its repr\";\n  }\n  proxy.$$.destroyed_msg = destroyed_msg;\n  pyproxy_decref_cache(proxy.$$.cache);\n  try {\n    Module._Py_DecRef(ptrobj);\n    trace_pyproxy_dealloc(proxy);\n  } catch (e) {\n    Module.fatal_error(e);\n  }\n};\n\n// Now a lot of boilerplate to wrap the abstract Object protocol wrappers\n// defined in pyproxy.c in JavaScript functions.\n\nModule.callPyObjectKwargs = function (ptrobj, ...jsargs) {\n  // We don't do any checking for kwargs, checks are in PyProxy.callKwargs\n  // which only is used when the keyword arguments come from the user.\n  let kwargs = jsargs.pop();\n  let num_pos_args = jsargs.length;\n  let kwargs_names = Object.keys(kwargs);\n  let kwargs_values = Object.values(kwargs);\n  let num_kwargs = kwargs_names.length;\n  jsargs.push(...kwargs_values);\n\n  let idargs = Module.hiwire.new_value(jsargs);\n  let idkwnames = Module.hiwire.new_value(kwargs_names);\n  let idresult;\n  try {\n    idresult = Module.__pyproxy_apply(\n      ptrobj,\n      idargs,\n      num_pos_args,\n      idkwnames,\n      num_kwargs\n    );\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.hiwire.decref(idargs);\n    Module.hiwire.decref(idkwnames);\n  }\n  if (idresult === 0) {\n    Module._pythonexc2js();\n  }\n  return Module.hiwire.pop_value(idresult);\n};\n\nModule.callPyObject = function (ptrobj, ...jsargs) {\n  return Module.callPyObjectKwargs(ptrobj, ...jsargs, {});\n};\n\n/**\n * @typedef {(PyProxyClass & {[x : string] : Py2JsResult})} PyProxy\n * @typedef { PyProxy | number | bigint | string | boolean | undefined } Py2JsResult\n */\nclass PyProxyClass {\n  constructor() {\n    throw new TypeError(\"PyProxy is not a constructor\");\n  }\n\n  get [Symbol.toStringTag]() {\n    return \"PyProxy\";\n  }\n  /**\n   * The name of the type of the object.\n   *\n   * Usually the value is ``\"module.name\"`` but for builtins or\n   * interpreter-defined types it is just ``\"name\"``. As pseudocode this is:\n   *\n   * .. code-block:: python\n   *\n   *    ty = type(x)\n   *    if ty.__module__ == 'builtins' or ty.__module__ == \"__main__\":\n   *        return ty.__name__\n   *    else:\n   *        ty.__module__ + \".\" + ty.__name__\n   *\n   * @type {string}\n   */\n  get type() {\n    let ptrobj = _getPtr(this);\n    return Module.hiwire.pop_value(Module.__pyproxy_type(ptrobj));\n  }\n  /**\n   * @returns {string}\n   */\n  toString() {\n    let ptrobj = _getPtr(this);\n    let jsref_repr;\n    try {\n      jsref_repr = Module.__pyproxy_repr(ptrobj);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    if (jsref_repr === 0) {\n      Module._pythonexc2js();\n    }\n    return Module.hiwire.pop_value(jsref_repr);\n  }\n  /**\n   * Destroy the ``PyProxy``. This will release the memory. Any further\n   * attempt to use the object will raise an error.\n   *\n   * In a browser supporting `FinalizationRegistry\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry>`_\n   * Pyodide will automatically destroy the ``PyProxy`` when it is garbage\n   * collected, however there is no guarantee that the finalizer will be run\n   * in a timely manner so it is better to ``destroy`` the proxy explicitly.\n   *\n   * @param {string} [destroyed_msg] The error message to print if use is\n   *        attempted after destroying. Defaults to \"Object has already been\n   *        destroyed\".\n   */\n  destroy(destroyed_msg) {\n    Module.pyproxy_destroy(this, destroyed_msg);\n  }\n  /**\n   * Make a new PyProxy pointing to the same Python object.\n   * Useful if the PyProxy is destroyed somewhere else.\n   * @returns {PyProxy}\n   */\n  copy() {\n    let ptrobj = _getPtr(this);\n    return Module.pyproxy_new(ptrobj, this.$$.cache);\n  }\n  /**\n   * Converts the ``PyProxy`` into a JavaScript object as best as possible. By\n   * default does a deep conversion, if a shallow conversion is desired, you can\n   * use ``proxy.toJs({depth : 1})``. See :ref:`Explicit Conversion of PyProxy\n   * <type-translations-pyproxy-to-js>` for more info.\n   *\n   * @param {object} options\n   * @param {number} [options.depth] How many layers deep to perform the\n   * conversion. Defaults to infinite.\n   * @param {array} [options.pyproxies] If provided, ``toJs`` will store all\n   * PyProxies created in this list. This allows you to easily destroy all the\n   * PyProxies by iterating the list without having to recurse over the\n   * generated structure. The most common use case is to create a new empty\n   * list, pass the list as `pyproxies`, and then later iterate over `pyproxies`\n   * to destroy all of created proxies.\n   * @param {boolean} [options.create_pyproxies] If false, ``toJs`` will throw a\n   * ``ConversionError`` rather than producing a ``PyProxy``.\n   * @param {boolean} [options.dict_converter] A function to be called on an\n   * iterable of pairs ``[key, value]``. Convert this iterable of pairs to the\n   * desired output. For instance, ``Object.fromEntries`` would convert the dict\n   * to an object, ``Array.from`` converts it to an array of entries, and ``(it) =>\n   * new Map(it)`` converts it to a ``Map`` (which is the default behavior).\n   * @return {any} The JavaScript object resulting from the conversion.\n   */\n  toJs({\n    depth = -1,\n    pyproxies,\n    create_pyproxies = (!!1),\n    dict_converter,\n  } = {}) {\n    let ptrobj = _getPtr(this);\n    let idresult;\n    let proxies_id;\n    let dict_converter_id = 0;\n    if (!create_pyproxies) {\n      proxies_id = 0;\n    } else if (pyproxies) {\n      proxies_id = Module.hiwire.new_value(pyproxies);\n    } else {\n      proxies_id = Module.hiwire.new_value([]);\n    }\n    if (dict_converter) {\n      dict_converter_id = Module.hiwire.new_value(dict_converter);\n    }\n    try {\n      idresult = Module._python2js_custom_dict_converter(\n        ptrobj,\n        depth,\n        proxies_id,\n        dict_converter_id\n      );\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(proxies_id);\n      Module.hiwire.decref(dict_converter_id);\n    }\n    if (idresult === 0) {\n      Module._pythonexc2js();\n    }\n    return Module.hiwire.pop_value(idresult);\n  }\n  /**\n   * Check whether the :any:`PyProxy.length` getter is available on this PyProxy. A\n   * Typescript type guard.\n   * @returns {this is PyProxyWithLength}\n   */\n  supportsLength() {\n    return !!(this.$$flags & (1 << 0));\n  }\n  /**\n   * Check whether the :any:`PyProxy.get` method is available on this PyProxy. A\n   * Typescript type guard.\n   * @returns {this is PyProxyWithGet}\n   */\n  supportsGet() {\n    return !!(this.$$flags & (1 << 1));\n  }\n  /**\n   * Check whether the :any:`PyProxy.set` method is available on this PyProxy. A\n   * Typescript type guard.\n   * @returns {this is PyProxyWithSet}\n   */\n  supportsSet() {\n    return !!(this.$$flags & (1 << 2));\n  }\n  /**\n   * Check whether the :any:`PyProxy.has` method is available on this PyProxy. A\n   * Typescript type guard.\n   * @returns {this is PyProxyWithHas}\n   */\n  supportsHas() {\n    return !!(this.$$flags & (1 << 3));\n  }\n  /**\n   * Check whether the PyProxy is iterable. A Typescript type guard for\n   * :any:`PyProxy.[Symbol.iterator]`.\n   * @returns {this is PyProxyIterable}\n   */\n  isIterable() {\n    return !!(this.$$flags & ((1 << 4) | (1 << 5)));\n  }\n  /**\n   * Check whether the PyProxy is iterable. A Typescript type guard for\n   * :any:`PyProxy.next`.\n   * @returns {this is PyProxyIterator}\n   */\n  isIterator() {\n    return !!(this.$$flags & (1 << 5));\n  }\n  /**\n   * Check whether the PyProxy is awaitable. A Typescript type guard, if this\n   * function returns true Typescript considers the PyProxy to be a ``Promise``.\n   * @returns {this is PyProxyAwaitable}\n   */\n  isAwaitable() {\n    return !!(this.$$flags & (1 << 6));\n  }\n  /**\n   * Check whether the PyProxy is a buffer. A Typescript type guard for\n   * :any:`PyProxy.getBuffer`.\n   * @returns {this is PyProxyBuffer}\n   */\n  isBuffer() {\n    return !!(this.$$flags & (1 << 7));\n  }\n  /**\n   * Check whether the PyProxy is a Callable. A Typescript type guard, if this\n   * returns true then Typescript considers the Proxy to be callable of\n   * signature ``(args... : any[]) => PyProxy | number | bigint | string |\n   * boolean | undefined``.\n   * @returns {this is PyProxyCallable}\n   */\n  isCallable() {\n    return !!(this.$$flags & (1 << 8));\n  }\n}\n\n/**\n * @typedef { PyProxy & PyProxyLengthMethods } PyProxyWithLength\n */\n// Controlled by HAS_LENGTH, appears for any object with __len__ or sq_length\n// or mp_length methods\nclass PyProxyLengthMethods {\n  /**\n   * The length of the object.\n   *\n   * Present only if the proxied Python object has a ``__len__`` method.\n   * @returns {number}\n   */\n  get length() {\n    let ptrobj = _getPtr(this);\n    let length;\n    try {\n      length = Module._PyObject_Size(ptrobj);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    if (length === -1) {\n      Module._pythonexc2js();\n    }\n    return length;\n  }\n}\n\n/**\n * @typedef {PyProxy & PyProxyGetItemMethods} PyProxyWithGet\n */\n\n// Controlled by HAS_GET, appears for any class with __getitem__,\n// mp_subscript, or sq_item methods\n/**\n * @interface\n */\nclass PyProxyGetItemMethods {\n  /**\n   * This translates to the Python code ``obj[key]``.\n   *\n   * Present only if the proxied Python object has a ``__getitem__`` method.\n   *\n   * @param {any} key The key to look up.\n   * @returns {Py2JsResult} The corresponding value.\n   */\n  get(key) {\n    let ptrobj = _getPtr(this);\n    let idkey = Module.hiwire.new_value(key);\n    let idresult;\n    try {\n      idresult = Module.__pyproxy_getitem(ptrobj, idkey);\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(idkey);\n    }\n    if (idresult === 0) {\n      if (Module._PyErr_Occurred()) {\n        Module._pythonexc2js();\n      } else {\n        return undefined;\n      }\n    }\n    return Module.hiwire.pop_value(idresult);\n  }\n}\n\n/**\n * @typedef {PyProxy & PyProxySetItemMethods} PyProxyWithSet\n */\n// Controlled by HAS_SET, appears for any class with __setitem__, __delitem__,\n// mp_ass_subscript,  or sq_ass_item.\nclass PyProxySetItemMethods {\n  /**\n   * This translates to the Python code ``obj[key] = value``.\n   *\n   * Present only if the proxied Python object has a ``__setitem__`` method.\n   *\n   * @param {any} key The key to set.\n   * @param {any} value The value to set it to.\n   */\n  set(key, value) {\n    let ptrobj = _getPtr(this);\n    let idkey = Module.hiwire.new_value(key);\n    let idval = Module.hiwire.new_value(value);\n    let errcode;\n    try {\n      errcode = Module.__pyproxy_setitem(ptrobj, idkey, idval);\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(idkey);\n      Module.hiwire.decref(idval);\n    }\n    if (errcode === -1) {\n      Module._pythonexc2js();\n    }\n  }\n  /**\n   * This translates to the Python code ``del obj[key]``.\n   *\n   * Present only if the proxied Python object has a ``__delitem__`` method.\n   *\n   * @param {any} key The key to delete.\n   */\n  delete(key) {\n    let ptrobj = _getPtr(this);\n    let idkey = Module.hiwire.new_value(key);\n    let errcode;\n    try {\n      errcode = Module.__pyproxy_delitem(ptrobj, idkey);\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(idkey);\n    }\n    if (errcode === -1) {\n      Module._pythonexc2js();\n    }\n  }\n}\n\n/**\n * @typedef {PyProxy & PyProxyContainsMethods} PyProxyWithHas\n */\n\n// Controlled by HAS_CONTAINS flag, appears for any class with __contains__ or\n// sq_contains\nclass PyProxyContainsMethods {\n  /**\n   * This translates to the Python code ``key in obj``.\n   *\n   * Present only if the proxied Python object has a ``__contains__`` method.\n   *\n   * @param {*} key The key to check for.\n   * @returns {boolean} Is ``key`` present?\n   */\n  has(key) {\n    let ptrobj = _getPtr(this);\n    let idkey = Module.hiwire.new_value(key);\n    let result;\n    try {\n      result = Module.__pyproxy_contains(ptrobj, idkey);\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(idkey);\n    }\n    if (result === -1) {\n      Module._pythonexc2js();\n    }\n    return result === 1;\n  }\n}\n\n/**\n * A helper for [Symbol.iterator].\n *\n * Because \"it is possible for a generator to be garbage collected without\n * ever running its finally block\", we take extra care to try to ensure that\n * we don't leak the iterator. We register it with the finalizationRegistry,\n * but if the finally block is executed, we decref the pointer and unregister.\n *\n * In order to do this, we create the generator with this inner method,\n * register the finalizer, and then return it.\n *\n * Quote from:\n * https://hacks.mozilla.org/2015/07/es6-in-depth-generators-continued/\n *\n * @private\n */\nfunction* iter_helper(iterptr, token) {\n  try {\n    let item;\n    while ((item = Module.__pyproxy_iter_next(iterptr))) {\n      yield Module.hiwire.pop_value(item);\n    }\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.finalizationRegistry.unregister(token);\n    Module._Py_DecRef(iterptr);\n  }\n  if (Module._PyErr_Occurred()) {\n    Module._pythonexc2js();\n  }\n}\n\n/**\n * @typedef {PyProxy & PyProxyIterableMethods} PyProxyIterable\n */\n\n// Controlled by IS_ITERABLE, appears for any object with __iter__ or tp_iter,\n// unless they are iterators. See: https://docs.python.org/3/c-api/iter.html\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\n// This avoids allocating a PyProxy wrapper for the temporary iterator.\nclass PyProxyIterableMethods {\n  /**\n   * This translates to the Python code ``iter(obj)``. Return an iterator\n   * associated to the proxy. See the documentation for `Symbol.iterator\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator>`_.\n   *\n   * Present only if the proxied Python object is iterable (i.e., has an\n   * ``__iter__`` method).\n   *\n   * This will be used implicitly by ``for(let x of proxy){}``.\n   *\n   * @returns {Iterator<Py2JsResult, Py2JsResult, any>} An iterator for the proxied Python object.\n   */\n  [Symbol.iterator]() {\n    let ptrobj = _getPtr(this);\n    let token = {};\n    let iterptr;\n    try {\n      iterptr = Module._PyObject_GetIter(ptrobj);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    if (iterptr === 0) {\n      Module._pythonexc2js();\n    }\n\n    let result = iter_helper(iterptr, token);\n    Module.finalizationRegistry.register(result, [iterptr, undefined], token);\n    return result;\n  }\n}\n\n/**\n * @typedef {PyProxy & PyProxyIteratorMethods} PyProxyIterator\n */\n\n// Controlled by IS_ITERATOR, appears for any object with a __next__ or\n// tp_iternext method.\nclass PyProxyIteratorMethods {\n  [Symbol.iterator]() {\n    return this;\n  }\n  /**\n   * This translates to the Python code ``next(obj)``. Returns the next value\n   * of the generator. See the documentation for `Generator.prototype.next\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next>`_.\n   * The argument will be sent to the Python generator.\n   *\n   * This will be used implicitly by ``for(let x of proxy){}``.\n   *\n   * Present only if the proxied Python object is a generator or iterator\n   * (i.e., has a ``send`` or ``__next__`` method).\n   *\n   * @param {any=} [value] The value to send to the generator. The value will be\n   * assigned as a result of a yield expression.\n   * @returns {IteratorResult<Py2JsResult, Py2JsResult>} An Object with two properties: ``done`` and ``value``.\n   * When the generator yields ``some_value``, ``next`` returns ``{done :\n   * false, value : some_value}``. When the generator raises a\n   * ``StopIteration(result_value)`` exception, ``next`` returns ``{done :\n   * true, value : result_value}``.\n   */\n  next(arg = undefined) {\n    let idresult;\n    // Note: arg is optional, if arg is not supplied, it will be undefined\n    // which gets converted to \"Py_None\". This is as intended.\n    let idarg = Module.hiwire.new_value(arg);\n    let done;\n    try {\n      idresult = Module.__pyproxyGen_Send(_getPtr(this), idarg);\n      done = idresult === 0;\n      if (done) {\n        idresult = Module.__pyproxyGen_FetchStopIterationValue();\n      }\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(idarg);\n    }\n    if (done && idresult === 0) {\n      Module._pythonexc2js();\n    }\n    let value = Module.hiwire.pop_value(idresult);\n    return { done, value };\n  }\n}\n\n// Another layer of boilerplate. The PyProxyHandlers have some annoying logic\n// to deal with straining out the spurious \"Function\" properties \"prototype\",\n// \"arguments\", and \"length\", to deal with correctly satisfying the Proxy\n// invariants, and to deal with the mro\nfunction python_hasattr(jsobj, jskey) {\n  let ptrobj = _getPtr(jsobj);\n  let idkey = Module.hiwire.new_value(jskey);\n  let result;\n  try {\n    result = Module.__pyproxy_hasattr(ptrobj, idkey);\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.hiwire.decref(idkey);\n  }\n  if (result === -1) {\n    Module._pythonexc2js();\n  }\n  return result !== 0;\n}\n\n// Returns a JsRef in order to allow us to differentiate between \"not found\"\n// (in which case we return 0) and \"found 'None'\" (in which case we return\n// Js_undefined).\nfunction python_getattr(jsobj, jskey) {\n  let ptrobj = _getPtr(jsobj);\n  let idkey = Module.hiwire.new_value(jskey);\n  let idresult;\n  let cacheId = jsobj.$$.cache.cacheId;\n  try {\n    idresult = Module.__pyproxy_getattr(ptrobj, idkey, cacheId);\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.hiwire.decref(idkey);\n  }\n  if (idresult === 0) {\n    if (Module._PyErr_Occurred()) {\n      Module._pythonexc2js();\n    }\n  }\n  return idresult;\n}\n\nfunction python_setattr(jsobj, jskey, jsval) {\n  let ptrobj = _getPtr(jsobj);\n  let idkey = Module.hiwire.new_value(jskey);\n  let idval = Module.hiwire.new_value(jsval);\n  let errcode;\n  try {\n    errcode = Module.__pyproxy_setattr(ptrobj, idkey, idval);\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.hiwire.decref(idkey);\n    Module.hiwire.decref(idval);\n  }\n  if (errcode === -1) {\n    Module._pythonexc2js();\n  }\n}\n\nfunction python_delattr(jsobj, jskey) {\n  let ptrobj = _getPtr(jsobj);\n  let idkey = Module.hiwire.new_value(jskey);\n  let errcode;\n  try {\n    errcode = Module.__pyproxy_delattr(ptrobj, idkey);\n  } catch (e) {\n    Module.fatal_error(e);\n  } finally {\n    Module.hiwire.decref(idkey);\n  }\n  if (errcode === -1) {\n    Module._pythonexc2js();\n  }\n}\n\n// See explanation of which methods should be defined here and what they do\n// here:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy\nlet PyProxyHandlers = {\n  isExtensible() {\n    return (!!1);\n  },\n  has(jsobj, jskey) {\n    // Note: must report \"prototype\" in proxy when we are callable.\n    // (We can return the wrong value from \"get\" handler though.)\n    let objHasKey = Reflect.has(jsobj, jskey);\n    if (objHasKey) {\n      return (!!1);\n    }\n    // python_hasattr will crash if given a Symbol.\n    if (typeof jskey === \"symbol\") {\n      return (!!0);\n    }\n    if (jskey.startsWith(\"$\")) {\n      jskey = jskey.slice(1);\n    }\n    return python_hasattr(jsobj, jskey);\n  },\n  get(jsobj, jskey) {\n    // Preference order:\n    // 1. stuff from JavaScript\n    // 2. the result of Python getattr\n\n    // python_getattr will crash if given a Symbol.\n    if (jskey in jsobj || typeof jskey === \"symbol\") {\n      return Reflect.get(jsobj, jskey);\n    }\n    // If keys start with $ remove the $. User can use initial $ to\n    // unambiguously ask for a key on the Python object.\n    if (jskey.startsWith(\"$\")) {\n      jskey = jskey.slice(1);\n    }\n    // 2. The result of getattr\n    let idresult = python_getattr(jsobj, jskey);\n    if (idresult !== 0) {\n      return Module.hiwire.pop_value(idresult);\n    }\n  },\n  set(jsobj, jskey, jsval) {\n    let descr = Object.getOwnPropertyDescriptor(jsobj, jskey);\n    if (descr && !descr.writable) {\n      throw new TypeError(`Cannot set read only field '${jskey}'`);\n    }\n    // python_setattr will crash if given a Symbol.\n    if (typeof jskey === \"symbol\") {\n      return Reflect.set(jsobj, jskey, jsval);\n    }\n    if (jskey.startsWith(\"$\")) {\n      jskey = jskey.slice(1);\n    }\n    python_setattr(jsobj, jskey, jsval);\n    return (!!1);\n  },\n  deleteProperty(jsobj, jskey) {\n    let descr = Object.getOwnPropertyDescriptor(jsobj, jskey);\n    if (descr && !descr.writable) {\n      throw new TypeError(`Cannot delete read only field '${jskey}'`);\n    }\n    if (typeof jskey === \"symbol\") {\n      return Reflect.deleteProperty(jsobj, jskey);\n    }\n    if (jskey.startsWith(\"$\")) {\n      jskey = jskey.slice(1);\n    }\n    python_delattr(jsobj, jskey);\n    // Must return \"false\" if \"jskey\" is a nonconfigurable own property.\n    // Otherwise JavaScript will throw a TypeError.\n    return !descr || descr.configurable;\n  },\n  ownKeys(jsobj) {\n    let ptrobj = _getPtr(jsobj);\n    let idresult;\n    try {\n      idresult = Module.__pyproxy_ownKeys(ptrobj);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    if (idresult === 0) {\n      Module._pythonexc2js();\n    }\n    let result = Module.hiwire.pop_value(idresult);\n    result.push(...Reflect.ownKeys(jsobj));\n    return result;\n  },\n  apply(jsobj, jsthis, jsargs) {\n    return jsobj.apply(jsthis, jsargs);\n  },\n};\n\n/**\n * @typedef {PyProxy & Promise<Py2JsResult>} PyProxyAwaitable\n */\n\n/**\n * The Promise / JavaScript awaitable API.\n * @private\n */\nclass PyProxyAwaitableMethods {\n  /**\n   * This wraps __pyproxy_ensure_future and makes a function that converts a\n   * Python awaitable to a promise, scheduling the awaitable on the Python\n   * event loop if necessary.\n   * @private\n   */\n  _ensure_future() {\n    if (this.$$.promise) {\n      return this.$$.promise;\n    }\n    let ptrobj = _getPtr(this);\n    let resolveHandle;\n    let rejectHandle;\n    let promise = new Promise((resolve, reject) => {\n      resolveHandle = resolve;\n      rejectHandle = reject;\n    });\n    let resolve_handle_id = Module.hiwire.new_value(resolveHandle);\n    let reject_handle_id = Module.hiwire.new_value(rejectHandle);\n    let errcode;\n    try {\n      errcode = Module.__pyproxy_ensure_future(\n        ptrobj,\n        resolve_handle_id,\n        reject_handle_id\n      );\n    } catch (e) {\n      Module.fatal_error(e);\n    } finally {\n      Module.hiwire.decref(reject_handle_id);\n      Module.hiwire.decref(resolve_handle_id);\n    }\n    if (errcode === -1) {\n      Module._pythonexc2js();\n    }\n    this.$$.promise = promise;\n    this.destroy();\n    return promise;\n  }\n  /**\n   * Runs ``asyncio.ensure_future(awaitable)``, executes\n   * ``onFulfilled(result)`` when the ``Future`` resolves successfully,\n   * executes ``onRejected(error)`` when the ``Future`` fails. Will be used\n   * implictly by ``await obj``.\n   *\n   * See the documentation for\n   * `Promise.then\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then>`_\n   *\n   * Present only if the proxied Python object is `awaitable\n   * <https://docs.python.org/3/library/asyncio-task.html?highlight=awaitable#awaitables>`_.\n   *\n   * @param {Function} onFulfilled A handler called with the result as an\n   * argument if the awaitable succeeds.\n   * @param {Function} onRejected A handler called with the error as an\n   * argument if the awaitable fails.\n   * @returns {Promise} The resulting Promise.\n   */\n  then(onFulfilled, onRejected) {\n    let promise = this._ensure_future();\n    return promise.then(onFulfilled, onRejected);\n  }\n  /**\n   * Runs ``asyncio.ensure_future(awaitable)`` and executes\n   * ``onRejected(error)`` if the future fails.\n   *\n   * See the documentation for\n   * `Promise.catch\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch>`_.\n   *\n   * Present only if the proxied Python object is `awaitable\n   * <https://docs.python.org/3/library/asyncio-task.html?highlight=awaitable#awaitables>`_.\n   *\n   * @param {Function} onRejected A handler called with the error as an\n   * argument if the awaitable fails.\n   * @returns {Promise} The resulting Promise.\n   */\n  catch(onRejected) {\n    let promise = this._ensure_future();\n    return promise.catch(onRejected);\n  }\n  /**\n   * Runs ``asyncio.ensure_future(awaitable)`` and executes\n   * ``onFinally(error)`` when the future resolves.\n   *\n   * See the documentation for\n   * `Promise.finally\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally>`_.\n   *\n   * Present only if the proxied Python object is `awaitable\n   * <https://docs.python.org/3/library/asyncio-task.html?highlight=awaitable#awaitables>`_.\n   *\n   *\n   * @param {Function} onFinally A handler that is called with zero arguments\n   * when the awaitable resolves.\n   * @returns {Promise} A Promise that resolves or rejects with the same\n   * result as the original Promise, but only after executing the\n   * ``onFinally`` handler.\n   */\n  finally(onFinally) {\n    let promise = this._ensure_future();\n    return promise.finally(onFinally);\n  }\n}\n\n/**\n * @typedef { PyProxy & PyProxyCallableMethods & ((...args : any[]) => Py2JsResult) } PyProxyCallable\n */\nclass PyProxyCallableMethods {\n  apply(jsthis, jsargs) {\n    return Module.callPyObject(_getPtr(this), ...jsargs);\n  }\n  call(jsthis, ...jsargs) {\n    return Module.callPyObject(_getPtr(this), ...jsargs);\n  }\n  /**\n   * Call the function with key word arguments.\n   * The last argument must be an object with the keyword arguments.\n   */\n  callKwargs(...jsargs) {\n    if (jsargs.length === 0) {\n      throw new TypeError(\n        \"callKwargs requires at least one argument (the key word argument object)\"\n      );\n    }\n    let kwargs = jsargs[jsargs.length - 1];\n    if (\n      kwargs.constructor !== undefined &&\n      kwargs.constructor.name !== \"Object\"\n    ) {\n      throw new TypeError(\"kwargs argument is not an object\");\n    }\n    return Module.callPyObjectKwargs(_getPtr(this), ...jsargs);\n  }\n}\nPyProxyCallableMethods.prototype.prototype = Function.prototype;\n\nlet type_to_array_map = new Map([\n  [\"i8\", Int8Array],\n  [\"u8\", Uint8Array],\n  [\"u8clamped\", Uint8ClampedArray],\n  [\"i16\", Int16Array],\n  [\"u16\", Uint16Array],\n  [\"i32\", Int32Array],\n  [\"u32\", Uint32Array],\n  [\"i32\", Int32Array],\n  [\"u32\", Uint32Array],\n  // if these aren't available, will be globalThis.BigInt64Array will be\n  // undefined rather than raising a ReferenceError.\n  [\"i64\", globalThis.BigInt64Array],\n  [\"u64\", globalThis.BigUint64Array],\n  [\"f32\", Float32Array],\n  [\"f64\", Float64Array],\n  [\"dataview\", DataView],\n]);\n\n/**\n * @typedef {PyProxy & PyProxyBufferMethods} PyProxyBuffer\n */\nclass PyProxyBufferMethods {\n  /**\n   * Get a view of the buffer data which is usable from JavaScript. No copy is\n   * ever performed.\n   *\n   * Present only if the proxied Python object supports the `Python Buffer\n   * Protocol <https://docs.python.org/3/c-api/buffer.html>`_.\n   *\n   * We do not support suboffsets, if the buffer requires suboffsets we will\n   * throw an error. JavaScript nd array libraries can't handle suboffsets\n   * anyways. In this case, you should use the :any:`toJs` api or copy the\n   * buffer to one that doesn't use suboffets (using e.g.,\n   * `numpy.ascontiguousarray\n   * <https://numpy.org/doc/stable/reference/generated/numpy.ascontiguousarray.html>`_).\n   *\n   * If the buffer stores big endian data or half floats, this function will\n   * fail without an explicit type argument. For big endian data you can use\n   * ``toJs``. `DataViews\n   * <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView>`_\n   * have support for big endian data, so you might want to pass\n   * ``'dataview'`` as the type argument in that case.\n   *\n   * @param {string=} [type] The type of the :any:`PyBuffer.data <pyodide.PyBuffer.data>` field in the\n   * output. Should be one of: ``\"i8\"``, ``\"u8\"``, ``\"u8clamped\"``, ``\"i16\"``,\n   * ``\"u16\"``, ``\"i32\"``, ``\"u32\"``, ``\"i32\"``, ``\"u32\"``, ``\"i64\"``,\n   * ``\"u64\"``, ``\"f32\"``, ``\"f64``, or ``\"dataview\"``. This argument is\n   * optional, if absent ``getBuffer`` will try to determine the appropriate\n   * output type based on the buffer `format string\n   * <https://docs.python.org/3/library/struct.html#format-strings>`_.\n   * @returns {PyBuffer} :any:`PyBuffer <pyodide.PyBuffer>`\n   */\n  getBuffer(type) {\n    let ArrayType = undefined;\n    if (type) {\n      ArrayType = type_to_array_map.get(type);\n      if (ArrayType === undefined) {\n        throw new Error(`Unknown type ${type}`);\n      }\n    }\n    let HEAPU32 = Module.HEAPU32;\n    let orig_stack_ptr = Module.stackSave();\n    let buffer_struct_ptr = Module.stackAlloc(\n      HEAPU32[(Module._buffer_struct_size >> 2) + 0]\n    );\n    let this_ptr = _getPtr(this);\n    let errcode;\n    try {\n      errcode = Module.__pyproxy_get_buffer(buffer_struct_ptr, this_ptr);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    if (errcode === -1) {\n      Module._pythonexc2js();\n    }\n\n    // This has to match the fields in buffer_struct\n    let startByteOffset = HEAPU32[(buffer_struct_ptr >> 2) + 0];\n    let minByteOffset = HEAPU32[(buffer_struct_ptr >> 2) + 1];\n    let maxByteOffset = HEAPU32[(buffer_struct_ptr >> 2) + 2];\n\n    let readonly = !!HEAPU32[(buffer_struct_ptr >> 2) + 3];\n    let format_ptr = HEAPU32[(buffer_struct_ptr >> 2) + 4];\n    let itemsize = HEAPU32[(buffer_struct_ptr >> 2) + 5];\n    let shape = Module.hiwire.pop_value(HEAPU32[(buffer_struct_ptr >> 2) + 6]);\n    let strides = Module.hiwire.pop_value(HEAPU32[(buffer_struct_ptr >> 2) + 7]);\n\n    let view_ptr = HEAPU32[(buffer_struct_ptr >> 2) + 8];\n    let c_contiguous = !!HEAPU32[(buffer_struct_ptr >> 2) + 9];\n    let f_contiguous = !!HEAPU32[(buffer_struct_ptr >> 2) + 10];\n\n    let format = Module.UTF8ToString(format_ptr);\n    Module.stackRestore(orig_stack_ptr);\n\n    let success = (!!0);\n    try {\n      let bigEndian = (!!0);\n      if (ArrayType === undefined) {\n        [ArrayType, bigEndian] = Module.processBufferFormatString(\n          format,\n          \" In this case, you can pass an explicit type argument.\"\n        );\n      }\n      let alignment = parseInt(ArrayType.name.replace(/[^0-9]/g, \"\")) / 8 || 1;\n      if (bigEndian && alignment > 1) {\n        throw new Error(\n          \"Javascript has no native support for big endian buffers. \" +\n            \"In this case, you can pass an explicit type argument. \" +\n            \"For instance, `getBuffer('dataview')` will return a `DataView`\" +\n            \"which has native support for reading big endian data. \" +\n            \"Alternatively, toJs will automatically convert the buffer \" +\n            \"to little endian.\"\n        );\n      }\n      let numBytes = maxByteOffset - minByteOffset;\n      if (\n        numBytes !== 0 &&\n        (startByteOffset % alignment !== 0 ||\n          minByteOffset % alignment !== 0 ||\n          maxByteOffset % alignment !== 0)\n      ) {\n        throw new Error(\n          `Buffer does not have valid alignment for a ${ArrayType.name}`\n        );\n      }\n      let numEntries = numBytes / alignment;\n      let offset = (startByteOffset - minByteOffset) / alignment;\n      let data;\n      if (numBytes === 0) {\n        data = new ArrayType();\n      } else {\n        data = new ArrayType(HEAPU32.buffer, minByteOffset, numEntries);\n      }\n      for (let i of strides.keys()) {\n        strides[i] /= alignment;\n      }\n\n      success = (!!1);\n      let result = Object.create(\n        PyBuffer.prototype,\n        Object.getOwnPropertyDescriptors({\n          offset,\n          readonly,\n          format,\n          itemsize,\n          ndim: shape.length,\n          nbytes: numBytes,\n          shape,\n          strides,\n          data,\n          c_contiguous,\n          f_contiguous,\n          _view_ptr: view_ptr,\n          _released: (!!0),\n        })\n      );\n      // Module.bufferFinalizationRegistry.register(result, view_ptr, result);\n      return result;\n    } finally {\n      if (!success) {\n        try {\n          Module._PyBuffer_Release(view_ptr);\n          Module._PyMem_Free(view_ptr);\n        } catch (e) {\n          Module.fatal_error(e);\n        }\n      }\n    }\n  }\n}\n\n/**\n * @typedef {Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array} TypedArray;\n */\n\n/**\n * A class to allow access to a Python data buffers from JavaScript. These are\n * produced by :any:`PyProxy.getBuffer` and cannot be constructed directly.\n * When you are done, release it with the :any:`release <PyBuffer.release>`\n * method.  See\n * `Python buffer protocol documentation\n * <https://docs.python.org/3/c-api/buffer.html>`_ for more information.\n *\n * To find the element ``x[a_1, ..., a_n]``, you could use the following code:\n *\n * .. code-block:: js\n *\n *    function multiIndexToIndex(pybuff, multiIndex){\n *       if(multindex.length !==pybuff.ndim){\n *          throw new Error(\"Wrong length index\");\n *       }\n *       let idx = pybuff.offset;\n *       for(let i = 0; i < pybuff.ndim; i++){\n *          if(multiIndex[i] < 0){\n *             multiIndex[i] = pybuff.shape[i] - multiIndex[i];\n *          }\n *          if(multiIndex[i] < 0 || multiIndex[i] >= pybuff.shape[i]){\n *             throw new Error(\"Index out of range\");\n *          }\n *          idx += multiIndex[i] * pybuff.stride[i];\n *       }\n *       return idx;\n *    }\n *    console.log(\"entry is\", pybuff.data[multiIndexToIndex(pybuff, [2, 0, -1])]);\n *\n * .. admonition:: Contiguity\n *    :class: warning\n *\n *    If the buffer is not contiguous, the ``data`` TypedArray will contain\n *    data that is not part of the buffer. Modifying this data may lead to\n *    undefined behavior.\n *\n * .. admonition:: Readonly buffers\n *    :class: warning\n *\n *    If ``buffer.readonly`` is ``true``, you should not modify the buffer.\n *    Modifying a readonly buffer may lead to undefined behavior.\n *\n * .. admonition:: Converting between TypedArray types\n *    :class: warning\n *\n *    The following naive code to change the type of a typed array does not\n *    work:\n *\n *    .. code-block:: js\n *\n *        // Incorrectly convert a TypedArray.\n *        // Produces a Uint16Array that points to the entire WASM memory!\n *        let myarray = new Uint16Array(buffer.data.buffer);\n *\n *    Instead, if you want to convert the output TypedArray, you need to say:\n *\n *    .. code-block:: js\n *\n *        // Correctly convert a TypedArray.\n *        let myarray = new Uint16Array(\n *            buffer.data.buffer,\n *            buffer.data.byteOffset,\n *            buffer.data.byteLength\n *        );\n */\nexport class PyBuffer {\n  constructor() {\n    /**\n     * The offset of the first entry of the array. For instance if our array\n     * is 3d, then you will find ``array[0,0,0]`` at\n     * ``pybuf.data[pybuf.offset]``\n     * @type {number}\n     */\n    this.offset;\n\n    /**\n     * If the data is readonly, you should not modify it. There is no way\n     * for us to enforce this, but it may cause very weird behavior.\n     * @type {boolean}\n     */\n    this.readonly;\n\n    /**\n     * The format string for the buffer. See `the Python documentation on\n     * format strings\n     * <https://docs.python.org/3/library/struct.html#format-strings>`_.\n     * @type {string}\n     */\n    this.format;\n\n    /**\n     * How large is each entry (in bytes)?\n     * @type {number}\n     */\n    this.itemsize;\n\n    /**\n     * The number of dimensions of the buffer. If ``ndim`` is 0, the buffer\n     * represents a single scalar or struct. Otherwise, it represents an\n     * array.\n     * @type {number}\n     */\n    this.ndim;\n\n    /**\n     * The total number of bytes the buffer takes up. This is equal to\n     * ``buff.data.byteLength``.\n     * @type {number}\n     */\n    this.nbytes;\n\n    /**\n     * The shape of the buffer, that is how long it is in each dimension.\n     * The length will be equal to ``ndim``. For instance, a 2x3x4 array\n     * would have shape ``[2, 3, 4]``.\n     * @type {number[]}\n     */\n    this.shape;\n\n    /**\n     * An array of of length ``ndim`` giving the number of elements to skip\n     * to get to a new element in each dimension. See the example definition\n     * of a ``multiIndexToIndex`` function above.\n     * @type {number[]}\n     */\n    this.strides;\n\n    /**\n     * The actual data. A typed array of an appropriate size backed by a\n     * segment of the WASM memory.\n     *\n     * The ``type`` argument of :any:`PyProxy.getBuffer`\n     * determines which sort of ``TypedArray`` this is. By default\n     * :any:`PyProxy.getBuffer` will look at the format string to determine the most\n     * appropriate option.\n     * @type {TypedArray}\n     */\n    this.data;\n\n    /**\n     * Is it C contiguous?\n     * @type {boolean}\n     */\n    this.c_contiguous;\n\n    /**\n     * Is it Fortran contiguous?\n     * @type {boolean}\n     */\n    this.f_contiguous;\n    throw new TypeError(\"PyBuffer is not a constructor\");\n  }\n\n  /**\n   * Release the buffer. This allows the memory to be reclaimed.\n   */\n  release() {\n    if (this._released) {\n      return;\n    }\n    // Module.bufferFinalizationRegistry.unregister(this);\n    try {\n      Module._PyBuffer_Release(this._view_ptr);\n      Module._PyMem_Free(this._view_ptr);\n    } catch (e) {\n      Module.fatal_error(e);\n    }\n    this._released = (!!1);\n    this.data = null;\n  }\n}\n","import { Module } from \"./module.js\";\nimport { loadPackage, loadedPackages } from \"./load-pyodide.js\";\nimport { isPyProxy, PyBuffer } from \"./pyproxy.gen.js\";\nexport { loadPackage, loadedPackages, isPyProxy };\n\n/**\n * @typedef {import('./pyproxy.gen').Py2JsResult} Py2JsResult\n * @typedef {import('./pyproxy.gen').PyProxy} PyProxy\n * @typedef {import('./pyproxy.gen').TypedArray} TypedArray\n * @typedef {import('emscripten')} Emscripten\n * @typedef {import('emscripten').Module.FS} FS\n */\n\n/**\n * An alias to the Python :py:mod:`pyodide` package.\n *\n * You can use this to call functions defined in the Pyodide Python package\n * from JavaScript.\n *\n * @type {PyProxy}\n */\nlet pyodide_py = {}; // actually defined in loadPyodide (see pyodide.js)\n\n/**\n *\n * An alias to the global Python namespace.\n *\n * For example, to access a variable called ``foo`` in the Python global\n * scope, use ``pyodide.globals.get(\"foo\")``\n *\n * @type {PyProxy}\n */\nlet globals = {}; // actually defined in loadPyodide (see pyodide.js)\n\n/**\n * A JavaScript error caused by a Python exception.\n *\n * In order to reduce the risk of large memory leaks, the ``PythonError``\n * contains no reference to the Python exception that caused it. You can find\n * the actual Python exception that caused this error as `sys.last_value\n * <https://docs.python.org/3/library/sys.html#sys.last_value>`_.\n *\n * See :ref:`type-translations-errors` for more information.\n *\n * .. admonition:: Avoid Stack Frames\n *    :class: warning\n *\n *    If you make a :any:`PyProxy` of ``sys.last_value``, you should be\n *    especially careful to :any:`destroy() <PyProxy.destroy>` it when you are\n *    done. You may leak a large amount of memory including the local\n *    variables of all the stack frames in the traceback if you don't. The\n *    easiest way is to only handle the exception in Python.\n *\n * @class\n */\nexport class PythonError {\n  // actually defined in error_handling.c. TODO: would be good to move this\n  // documentation and the definition of PythonError to error_handling.js\n  constructor() {\n    /**\n     * The Python traceback.\n     * @type {string}\n     */\n    this.message;\n  }\n}\n\n/**\n *\n * The Pyodide version.\n *\n * It can be either the exact release version (e.g. ``0.1.0``), or\n * the latest release version followed by the number of commits since, and\n * the git hash of the current commit (e.g. ``0.1.0-1-bd84646``).\n *\n * @type {string}\n */\nexport let version = \"\"; // actually defined in loadPyodide (see pyodide.js)\n\n/**\n * Runs a string of Python code from JavaScript.\n *\n * The last part of the string may be an expression, in which case, its value\n * is returned.\n *\n * @param {string} code Python code to evaluate\n * @param {PyProxy=} globals An optional Python dictionary to use as the globals.\n *        Defaults to :any:`pyodide.globals`. Uses the Python API\n *        :any:`pyodide.eval_code` to evaluate the code.\n * @returns {Py2JsResult} The result of the Python code translated to JavaScript. See the\n *          documentation for :any:`pyodide.eval_code` for more info.\n */\nexport function runPython(code, globals = Module.globals) {\n  return Module.pyodide_py.eval_code(code, globals);\n}\nModule.runPython = runPython;\n\n/**\n * @callback LogFn\n * @param {string} msg\n * @returns {void}\n * @private\n */\n\n/**\n * Inspect a Python code chunk and use :js:func:`pyodide.loadPackage` to install\n * any known packages that the code chunk imports. Uses the Python API\n * :func:`pyodide.find\\_imports` to inspect the code.\n *\n * For example, given the following code as input\n *\n * .. code-block:: python\n *\n *    import numpy as np x = np.array([1, 2, 3])\n *\n * :js:func:`loadPackagesFromImports` will call\n * ``pyodide.loadPackage(['numpy'])``.\n *\n * @param {string} code The code to inspect.\n * @param {LogFn=} messageCallback The ``messageCallback`` argument of\n * :any:`pyodide.loadPackage` (optional).\n * @param {LogFn=} errorCallback The ``errorCallback`` argument of\n * :any:`pyodide.loadPackage` (optional).\n * @async\n */\nexport async function loadPackagesFromImports(\n  code,\n  messageCallback,\n  errorCallback\n) {\n  let pyimports = Module.pyodide_py.find_imports(code);\n  let imports;\n  try {\n    imports = pyimports.toJs();\n  } finally {\n    pyimports.destroy();\n  }\n  if (imports.length === 0) {\n    return;\n  }\n\n  let packageNames = Module._import_name_to_package_name;\n  let packages = new Set();\n  for (let name of imports) {\n    if (packageNames.has(name)) {\n      packages.add(packageNames.get(name));\n    }\n  }\n  if (packages.size) {\n    await loadPackage(Array.from(packages), messageCallback, errorCallback);\n  }\n}\n\n/**\n * Runs Python code using `PyCF_ALLOW_TOP_LEVEL_AWAIT\n * <https://docs.python.org/3/library/ast.html?highlight=pycf_allow_top_level_await#ast.PyCF_ALLOW_TOP_LEVEL_AWAIT>`_.\n *\n * .. admonition:: Python imports\n *    :class: warning\n *\n *    Since pyodide 0.18.0, you must call :js:func:`loadPackagesFromImports` to\n *    import any python packages referenced via `import` statements in your code.\n *    This function will no longer do it for you.\n *\n * For example:\n *\n * .. code-block:: pyodide\n *\n *    let result = await pyodide.runPythonAsync(`\n *        from js import fetch\n *        response = await fetch(\"./packages.json\")\n *        packages = await response.json()\n *        # If final statement is an expression, its value is returned to JavaScript\n *        len(packages.packages.object_keys())\n *    `);\n *    console.log(result); // 79\n *\n * @param {string} code Python code to evaluate\n * @param {PyProxy=} globals An optional Python dictionary to use as the globals.\n *        Defaults to :any:`pyodide.globals`. Uses the Python API\n *        :any:`pyodide.eval_code_async` to evaluate the code.\n * @returns {Py2JsResult} The result of the Python code translated to JavaScript.\n * @async\n */\nexport async function runPythonAsync(code, globals = Module.globals) {\n  return await Module.pyodide_py.eval_code_async(code, globals);\n}\nModule.runPythonAsync = runPythonAsync;\n\n/**\n * Registers the JavaScript object ``module`` as a JavaScript module named\n * ``name``. This module can then be imported from Python using the standard\n * Python import system. If another module by the same name has already been\n * imported, this won't have much effect unless you also delete the imported\n * module from ``sys.modules``. This calls the ``pyodide_py`` API\n * :func:`pyodide.register_js_module`.\n *\n * @param {string} name Name of the JavaScript module to add\n * @param {object} module JavaScript object backing the module\n */\nexport function registerJsModule(name, module) {\n  Module.pyodide_py.register_js_module(name, module);\n}\n\n/**\n * Tell Pyodide about Comlink.\n * Necessary to enable importing Comlink proxies into Python.\n */\nexport function registerComlink(Comlink) {\n  Module._Comlink = Comlink;\n}\n\n/**\n * Unregisters a JavaScript module with given name that has been previously\n * registered with :js:func:`pyodide.registerJsModule` or\n * :func:`pyodide.register_js_module`. If a JavaScript module with that name\n * does not already exist, will throw an error. Note that if the module has\n * already been imported, this won't have much effect unless you also delete\n * the imported module from ``sys.modules``. This calls the ``pyodide_py`` API\n * :func:`pyodide.unregister_js_module`.\n *\n * @param {string} name Name of the JavaScript module to remove\n */\nexport function unregisterJsModule(name) {\n  Module.pyodide_py.unregister_js_module(name);\n}\n\n/**\n * Convert the JavaScript object to a Python object as best as possible.\n *\n * This is similar to :any:`JsProxy.to_py` but for use from JavaScript. If the\n * object is immutable or a :any:`PyProxy`, it will be returned unchanged. If\n * the object cannot be converted into Python, it will be returned unchanged.\n *\n * See :ref:`type-translations-jsproxy-to-py` for more information.\n *\n * @param {*} obj\n * @param {object} options\n * @param {number=} options.depth Optional argument to limit the depth of the\n * conversion.\n * @returns {PyProxy} The object converted to Python.\n */\nexport function toPy(obj, { depth = -1 } = {}) {\n  // No point in converting these, it'd be dumb to proxy them so they'd just\n  // get converted back by `js2python` at the end\n  switch (typeof obj) {\n    case \"string\":\n    case \"number\":\n    case \"boolean\":\n    case \"bigint\":\n    case \"undefined\":\n      return obj;\n  }\n  if (!obj || Module.isPyProxy(obj)) {\n    return obj;\n  }\n  let obj_id = 0;\n  let py_result = 0;\n  let result = 0;\n  try {\n    obj_id = Module.hiwire.new_value(obj);\n    try {\n      py_result = Module.js2python_convert(obj_id, new Map(), depth);\n    } catch (e) {\n      if (e instanceof Module._PropagatePythonError) {\n        Module._pythonexc2js();\n      }\n      throw e;\n    }\n    if (Module._JsProxy_Check(py_result)) {\n      // Oops, just created a JsProxy. Return the original object.\n      return obj;\n      // return Module.pyproxy_new(py_result);\n    }\n    result = Module._python2js(py_result);\n    if (result === 0) {\n      Module._pythonexc2js();\n    }\n  } finally {\n    Module.hiwire.decref(obj_id);\n    Module._Py_DecRef(py_result);\n  }\n  return Module.hiwire.pop_value(result);\n}\n\n/**\n * Imports a module and returns it.\n *\n * .. admonition:: Warning\n *    :class: warning\n *\n *    This function has a completely different behavior than the old removed pyimport function!\n *\n *    ``pyimport`` is roughly equivalent to:\n *\n *    .. code-block:: js\n *\n *      pyodide.runPython(`import ${pkgname}; ${pkgname}`);\n *\n *    except that the global namespace will not change.\n *\n *    Example:\n *\n *    .. code-block:: js\n *\n *      let sysmodule = pyodide.pyimport(\"sys\");\n *      let recursionLimit = sys.getrecursionlimit();\n *\n * @param {string} mod_name The name of the module to import\n * @returns A PyProxy for the imported module\n */\nexport function pyimport(mod_name) {\n  return Module.importlib.import_module(mod_name);\n}\n\n/**\n * Unpack an archive into a target directory.\n *\n * @param {ArrayBuffer} buffer The archive as an ArrayBuffer (it's also fine to pass a TypedArray).\n * @param {string} format The format of the archive. Should be one of the formats recognized by `shutil.unpack_archive`.\n * By default the options are 'bztar', 'gztar', 'tar', 'zip', and 'wheel'. Several synonyms are accepted for each format, e.g.,\n * for 'gztar' any of '.gztar', '.tar.gz', '.tgz', 'tar.gz' or 'tgz' are considered to be synonyms.\n *\n * @param {string=} extract_dir The directory to unpack the archive into. Defaults to the working directory.\n */\nexport function unpackArchive(buffer, format, extract_dir) {\n  if (!Module._util_module) {\n    Module._util_module = pyimport(\"pyodide._util\");\n  }\n  Module._util_module.unpack_buffer_archive.callKwargs(buffer, {\n    format,\n    extract_dir,\n  });\n}\n\n/**\n * @private\n */\nModule.saveState = () => Module.pyodide_py._state.save_state();\n\n/**\n * @private\n */\nModule.restoreState = (state) => Module.pyodide_py._state.restore_state(state);\n\n/**\n * Sets the interrupt buffer to be `interrupt_buffer`. This is only useful when\n * Pyodide is used in a webworker. The buffer should be a `SharedArrayBuffer`\n * shared with the main browser thread (or another worker). To request an\n * interrupt, a `2` should be written into `interrupt_buffer` (2 is the posix\n * constant for SIGINT).\n *\n * @param {TypedArray} interrupt_buffer\n */\nexport function setInterruptBuffer(interrupt_buffer) {\n  Module.interrupt_buffer = interrupt_buffer;\n  Module._set_pyodide_callback(!!interrupt_buffer);\n}\n\n/**\n * Throws a KeyboardInterrupt error if a KeyboardInterrupt has been requested\n * via the interrupt buffer.\n *\n * This can be used to enable keyboard interrupts during execution of JavaScript\n * code, just as `PyErr_CheckSignals` is used to enable keyboard interrupts\n * during execution of C code.\n */\nexport function checkInterrupt() {\n  if (Module.interrupt_buffer[0] === 2) {\n    Module.interrupt_buffer[0] = 0;\n    Module._PyErr_SetInterrupt();\n    Module.runPython(\"\");\n  }\n}\n\nexport function makePublicAPI() {\n  /**\n   * An alias to the `Emscripten File System API\n   * <https://emscripten.org/docs/api_reference/Filesystem-API.html>`_.\n   *\n   * This provides a wide range of POSIX-`like` file/device operations, including\n   * `mount\n   * <https://emscripten.org/docs/api_reference/Filesystem-API.html#FS.mount>`_\n   * which can be used to extend the in-memory filesystem with features like `persistence\n   * <https://emscripten.org/docs/api_reference/Filesystem-API.html#persistent-data>`_.\n   *\n   * While all the file systems implementations are enabled, only the default\n   * ``MEMFS`` is guaranteed to work in all runtime settings. The implementations\n   * are available as members of ``FS.filesystems``:\n   * ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.\n   *\n   * @type {FS}\n   */\n  const FS = Module.FS;\n  let namespace = {\n    globals,\n    FS,\n    pyodide_py,\n    version,\n    loadPackage,\n    loadPackagesFromImports,\n    loadedPackages,\n    isPyProxy,\n    runPython,\n    runPythonAsync,\n    registerJsModule,\n    unregisterJsModule,\n    setInterruptBuffer,\n    checkInterrupt,\n    toPy,\n    pyimport,\n    unpackArchive,\n    registerComlink,\n    PythonError,\n    PyBuffer,\n  };\n\n  namespace._module = Module; // @private\n  Module.public_api = namespace;\n  return namespace;\n}\n","/**\n * The main bootstrap code for loading pyodide.\n */\nimport { Module, setStandardStreams, setHomeDirectory } from \"./module.js\";\nimport {\n  loadScript,\n  initializePackageIndex,\n  _fetchBinaryFile,\n  loadPackage,\n} from \"./load-pyodide.js\";\nimport { makePublicAPI, registerJsModule } from \"./api.js\";\nimport \"./pyproxy.gen.js\";\n\n/**\n * @typedef {import('./pyproxy.gen').PyProxy} PyProxy\n * @typedef {import('./pyproxy.gen').PyProxyWithLength} PyProxyWithLength\n * @typedef {import('./pyproxy.gen').PyProxyWithGet} PyProxyWithGet\n * @typedef {import('./pyproxy.gen').PyProxyWithSet} PyProxyWithSet\n * @typedef {import('./pyproxy.gen').PyProxyWithHas} PyProxyWithHas\n * @typedef {import('./pyproxy.gen').PyProxyIterable} PyProxyIterable\n * @typedef {import('./pyproxy.gen').PyProxyIterator} PyProxyIterator\n * @typedef {import('./pyproxy.gen').PyProxyAwaitable} PyProxyAwaitable\n * @typedef {import('./pyproxy.gen').PyProxyBuffer} PyProxyBuffer\n * @typedef {import('./pyproxy.gen').PyProxyCallable} PyProxyCallable\n *\n * @typedef {import('./pyproxy.gen').Py2JsResult} Py2JsResult\n *\n * @typedef {import('./pyproxy.gen').TypedArray} TypedArray\n * @typedef {import('./pyproxy.gen').PyBuffer} PyBuffer\n */\n\n/**\n * Dump the Python traceback to the browser console.\n *\n * @private\n */\nModule.dump_traceback = function () {\n  const fd_stdout = 1;\n  Module.__Py_DumpTraceback(fd_stdout, Module._PyGILState_GetThisThreadState());\n};\n\nlet fatal_error_occurred = false;\n/**\n * Signal a fatal error.\n *\n * Dumps the Python traceback, shows a JavaScript traceback, and prints a clear\n * message indicating a fatal error. It then dummies out the public API so that\n * further attempts to use Pyodide will clearly indicate that Pyodide has failed\n * and can no longer be used. pyodide._module is left accessible, and it is\n * possible to continue using Pyodide for debugging purposes if desired.\n *\n * @argument e {Error} The cause of the fatal error.\n * @private\n */\nModule.fatal_error = function (e) {\n  if (e.pyodide_fatal_error) {\n    return;\n  }\n  if (fatal_error_occurred) {\n    console.error(\"Recursive call to fatal_error. Inner error was:\");\n    console.error(e);\n    return;\n  }\n  // Mark e so we know not to handle it later in EM_JS wrappers\n  e.pyodide_fatal_error = true;\n  fatal_error_occurred = true;\n  console.error(\n    \"Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.\"\n  );\n  console.error(\"The cause of the fatal error was:\");\n  if (Module.inTestHoist) {\n    // Test hoist won't print the error object in a useful way so convert it to\n    // string.\n    console.error(e.toString());\n    console.error(e.stack);\n  } else {\n    console.error(e);\n  }\n  try {\n    Module.dump_traceback();\n    for (let key of Object.keys(Module.public_api)) {\n      if (key.startsWith(\"_\") || key === \"version\") {\n        continue;\n      }\n      Object.defineProperty(Module.public_api, key, {\n        enumerable: true,\n        configurable: true,\n        get: () => {\n          throw new Error(\n            \"Pyodide already fatally failed and can no longer be used.\"\n          );\n        },\n      });\n    }\n    if (Module.on_fatal) {\n      Module.on_fatal(e);\n    }\n  } catch (err2) {\n    console.error(\"Another error occurred while handling the fatal error:\");\n    console.error(err2);\n  }\n  throw e;\n};\n\nlet runPythonInternal_dict; // Initialized in finalizeBootstrap\n/**\n * Just like `runPython` except uses a different globals dict and gets\n * `eval_code` from `_pyodide` so that it can work before `pyodide` is imported.\n * @private\n */\nModule.runPythonInternal = function (code) {\n  return Module._pyodide._base.eval_code(code, runPythonInternal_dict);\n};\n\n/**\n * A proxy around globals that falls back to checking for a builtin if has or\n * get fails to find a global with the given key. Note that this proxy is\n * transparent to js2python: it won't notice that this wrapper exists at all and\n * will translate this proxy to the globals dictionary.\n * @private\n */\nfunction wrapPythonGlobals(globals_dict, builtins_dict) {\n  return new Proxy(globals_dict, {\n    get(target, symbol) {\n      if (symbol === \"get\") {\n        return (key) => {\n          let result = target.get(key);\n          if (result === undefined) {\n            result = builtins_dict.get(key);\n          }\n          return result;\n        };\n      }\n      if (symbol === \"has\") {\n        return (key) => target.has(key) || builtins_dict.has(key);\n      }\n      return Reflect.get(target, symbol);\n    },\n  });\n}\n\nfunction unpackPyodidePy(pyodide_py_tar) {\n  const fileName = \"/pyodide_py.tar\";\n  let stream = Module.FS.open(fileName, \"w\");\n  Module.FS.write(\n    stream,\n    new Uint8Array(pyodide_py_tar),\n    0,\n    pyodide_py_tar.byteLength,\n    undefined,\n    true\n  );\n  Module.FS.close(stream);\n  const code_ptr = Module.stringToNewUTF8(`\nimport shutil\nshutil.unpack_archive(\"/pyodide_py.tar\", \"/lib/python3.9/site-packages/\")\ndel shutil\nimport importlib\nimportlib.invalidate_caches()\ndel importlib\n    `);\n  let errcode = Module._PyRun_SimpleString(code_ptr);\n  if (errcode) {\n    throw new Error(\"OOPS!\");\n  }\n  Module._free(code_ptr);\n  Module.FS.unlink(fileName);\n}\n\n/**\n * This function is called after the emscripten module is finished initializing,\n * so eval_code is newly available.\n * It finishes the bootstrap so that once it is complete, it is possible to use\n * the core `pyodide` apis. (But package loading is not ready quite yet.)\n * @private\n */\nfunction finalizeBootstrap(config) {\n  // First make internal dict so that we can use runPythonInternal.\n  // runPythonInternal uses a separate namespace, so we don't pollute the main\n  // environment with variables from our setup.\n  runPythonInternal_dict = Module._pyodide._base.eval_code(\"{}\");\n  Module.importlib = Module.runPythonInternal(\"import importlib; importlib\");\n  let import_module = Module.importlib.import_module;\n\n  Module.sys = import_module(\"sys\");\n  Module.sys.path.insert(0, config.homedir);\n\n  // Set up globals\n  let globals = Module.runPythonInternal(\"import __main__; __main__.__dict__\");\n  let builtins = Module.runPythonInternal(\"import builtins; builtins.__dict__\");\n  Module.globals = wrapPythonGlobals(globals, builtins);\n\n  // Set up key Javascript modules.\n  let importhook = Module._pyodide._importhook;\n  importhook.register_js_finder();\n  importhook.register_js_module(\"js\", config.jsglobals);\n\n  let pyodide = makePublicAPI();\n  importhook.register_js_module(\"pyodide_js\", pyodide);\n\n  // import pyodide_py. We want to ensure that as much stuff as possible is\n  // already set up before importing pyodide_py to simplify development of\n  // pyodide_py code (Otherwise it's very hard to keep track of which things\n  // aren't set up yet.)\n  Module.pyodide_py = import_module(\"pyodide\");\n  Module.version = Module.pyodide_py.__version__;\n\n  // copy some last constants onto public API.\n  pyodide.pyodide_py = Module.pyodide_py;\n  pyodide.version = Module.version;\n  pyodide.globals = Module.globals;\n  return pyodide;\n}\n\n/**\n * Load the main Pyodide wasm module and initialize it.\n *\n * Only one copy of Pyodide can be loaded in a given JavaScript global scope\n * because Pyodide uses global variables to load packages. If an attempt is made\n * to load a second copy of Pyodide, :any:`loadPyodide` will throw an error.\n * (This can be fixed once `Firefox adopts support for ES6 modules in webworkers\n * <https://bugzilla.mozilla.org/show_bug.cgi?id=1247687>`_.)\n *\n * @param {string} config.indexURL - The URL from which Pyodide will load\n * packages\n * @param {string} config.homedir - The home directory which Pyodide will use inside virtual file system\n * Default: /home/pyodide\n * @param {boolean} config.fullStdLib - Load the full Python standard library.\n * Setting this to false excludes following modules: distutils.\n * Default: true\n * @param {undefined | function(): string} config.stdin - Override the standard input callback. Should ask the user for one line of input.\n * Default: undefined\n * @param {undefined | function(string)} config.stdout - Override the standard output callback.\n * Default: undefined\n * @param {undefined | function(string)} config.stderr - Override the standard error output callback.\n * Default: undefined\n * @returns The :ref:`js-api-pyodide` module.\n * @memberof globalThis\n * @async\n */\nexport async function loadPyodide(config) {\n  if (globalThis.__pyodide_module) {\n    throw new Error(\"Pyodide is already loading.\");\n  }\n  if (!config.indexURL) {\n    throw new Error(\"Please provide indexURL parameter to loadPyodide\");\n  }\n\n  loadPyodide.inProgress = true;\n  // A global \"mount point\" for the package loaders to talk to pyodide\n  // See \"--export-name=__pyodide_module\" in buildpkg.py\n  globalThis.__pyodide_module = Module;\n\n  const default_config = {\n    fullStdLib: true,\n    jsglobals: globalThis,\n    stdin: globalThis.prompt ? globalThis.prompt : undefined,\n    homedir: \"/home/pyodide\",\n  };\n  config = Object.assign(default_config, config);\n\n  if (!config.indexURL.endsWith(\"/\")) {\n    config.indexURL += \"/\";\n  }\n  Module.indexURL = config.indexURL;\n  let packageIndexReady = initializePackageIndex(config.indexURL);\n  let pyodide_py_tar_promise = _fetchBinaryFile(\n    config.indexURL,\n    \"pyodide_py.tar\"\n  );\n\n  setStandardStreams(config.stdin, config.stdout, config.stderr);\n  setHomeDirectory(config.homedir);\n\n  let moduleLoaded = new Promise((r) => (Module.postRun = r));\n\n  const scriptSrc = `${config.indexURL}pyodide.asm.js`;\n  await loadScript(scriptSrc);\n\n  // _createPyodideModule is specified in the Makefile by the linker flag:\n  // `-s EXPORT_NAME=\"'_createPyodideModule'\"`\n  await _createPyodideModule(Module);\n\n  // There is some work to be done between the module being \"ready\" and postRun\n  // being called.\n  await moduleLoaded;\n\n  const pyodide_py_tar = await pyodide_py_tar_promise;\n  unpackPyodidePy(pyodide_py_tar);\n  Module._pyodide_init();\n\n  let pyodide = finalizeBootstrap(config);\n  // Module.runPython works starting here.\n\n  await packageIndexReady;\n  if (config.fullStdLib) {\n    await loadPackage([\"distutils\"]);\n  }\n  pyodide.runPython(\"print('Python initialization complete')\");\n  return pyodide;\n}\nglobalThis.loadPyodide = loadPyodide;\n"],"names":["Module","setStandardStreams","stdin","stdout","stderr","print","printErr","preRun","push","FS","init","encoder","TextEncoder","input","Uint8Array","inputIndex","stdinWrapper","text","TypeError","endsWith","encode","length","character","e","console","error","createStdinWrapper","noImageDecoding","noAudioDecoding","noWasmDecoding","preloadedWasm","IN_NODE","process","release","name","browser","baseURL","package_uri_regexp","_uri_to_package_name","package_uri","match","exec","toLowerCase","loadScript","globalThis","document","async","url","import","importScripts","Error","pathPromise","then","M","default","fetchPromise","vmPromise","includes","fetch","runInThisContext","path","resolve","addPackageToLoad","toLoad","has","set","undefined","loadedPackages","dep_name","packages","depends","recursiveDependencies","names","_messageCallback","errorCallback","sharedLibsOnly","Map","pkgname","get","onlySharedLibs","c","shared_library","waitRunDependency","promise","Promise","r","monitorRunDependencies","n","addRunDependency","removeRunDependency","_loadPackage","messageCallback","locateFile_packagesToLoad","size","Array","from","keys","join","scriptPromises","pkg","uri","loaded","scriptSrc","catch","delete","all","resolveMsg","packageList","reportUndefinedSymbols","importlib","invalidate_caches","locateFile","replace","_package_lock","sharedLibraryWasmPlugin","origWasmPlugin","wasmPluginIndex","useSharedLibraryWasmPlugin","p","preloadPlugins","canHandle","handle","byteArray","onload","onerror","asyncWasmLoadPromise","loadDynamicLibrary","global","nodelete","initSharedLibraryWasmPlugin","restoreOrigWasmPlugin","loadPackage","isPyProxy","temp","toJs","destroy","isArray","sharedLibraryNames","sharedLibraryPackagesToLoad","releaseLock","old_lock","acquirePackageLock","log","jsobj","$$","type","FinalizationRegistry","finalizationRegistry","ptr","cache","leaked","pyproxy_decref_cache","_Py_DecRef","fatal_error","register","unregister","trace_pyproxy_alloc","trace_pyproxy_dealloc","pyproxy_alloc_map","_getPtr","destroyed_msg","enable_pyproxy_allocation_tracing","proxy","stack","disable_pyproxy_allocation_tracing","pyproxy_new","ptrobj","target","flags","_pyproxy_getflags","cls","getPyProxyClass","Reflect","construct","Function","prototype","Object","create","cacheId","hiwire","new_value","refcnt","defineProperty","value","_Py_IncRef","Proxy","PyProxyHandlers","pyproxyClassMap","result","descriptors","feature_flag","methods","PyProxyLengthMethods","PyProxyGetItemMethods","PyProxySetItemMethods","PyProxyContainsMethods","PyProxyIterableMethods","PyProxyIteratorMethods","PyProxyAwaitableMethods","PyProxyBufferMethods","PyProxyCallableMethods","assign","getOwnPropertyDescriptors","constructor","getOwnPropertyDescriptor","PyProxyClass","$$flags","new_proto","NewPyProxyClass","PyProxy_getPtr","cache_map","pop_value","proxy_id","values","cache_entry","pyproxy_destroy","proxy_repr","proxy_type","toString","pyodide_fatal_error","callPyObjectKwargs","jsargs","kwargs","pop","num_pos_args","kwargs_names","kwargs_values","num_kwargs","idresult","idargs","idkwnames","__pyproxy_apply","decref","_pythonexc2js","callPyObject","Symbol","toStringTag","this","__pyproxy_type","jsref_repr","__pyproxy_repr","copy","depth","pyproxies","create_pyproxies","dict_converter","proxies_id","dict_converter_id","_python2js_custom_dict_converter","supportsLength","supportsGet","supportsSet","supportsHas","isIterable","isIterator","isAwaitable","isBuffer","isCallable","_PyObject_Size","key","idkey","__pyproxy_getitem","_PyErr_Occurred","errcode","idval","__pyproxy_setitem","__pyproxy_delitem","__pyproxy_contains","iterator","iterptr","token","_PyObject_GetIter","item","__pyproxy_iter_next","iter_helper","next","arg","done","idarg","__pyproxyGen_Send","__pyproxyGen_FetchStopIterationValue","isExtensible","jskey","startsWith","slice","__pyproxy_hasattr","python_hasattr","__pyproxy_getattr","python_getattr","jsval","descr","writable","__pyproxy_setattr","python_setattr","deleteProperty","__pyproxy_delattr","python_delattr","configurable","ownKeys","__pyproxy_ownKeys","apply","jsthis","_ensure_future","resolveHandle","rejectHandle","reject","resolve_handle_id","reject_handle_id","__pyproxy_ensure_future","onFulfilled","onRejected","finally","onFinally","call","callKwargs","type_to_array_map","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","BigInt64Array","BigUint64Array","Float32Array","Float64Array","DataView","getBuffer","ArrayType","HEAPU32","orig_stack_ptr","stackSave","buffer_struct_ptr","stackAlloc","_buffer_struct_size","this_ptr","__pyproxy_get_buffer","startByteOffset","minByteOffset","maxByteOffset","readonly","format_ptr","itemsize","shape","strides","view_ptr","c_contiguous","f_contiguous","format","UTF8ToString","stackRestore","success","bigEndian","processBufferFormatString","alignment","parseInt","numBytes","data","numEntries","offset","buffer","i","PyBuffer","ndim","nbytes","_view_ptr","_released","_PyBuffer_Release","_PyMem_Free","pyodide_py","globals","PythonError","message","runPython","code","eval_code","loadPackagesFromImports","imports","pyimports","find_imports","packageNames","_import_name_to_package_name","Set","add","runPythonAsync","eval_code_async","registerJsModule","module","register_js_module","registerComlink","Comlink","_Comlink","unregisterJsModule","unregister_js_module","toPy","obj","obj_id","py_result","js2python_convert","_PropagatePythonError","_JsProxy_Check","_python2js","pyimport","mod_name","import_module","unpackArchive","extract_dir","_util_module","unpack_buffer_archive","setInterruptBuffer","interrupt_buffer","_set_pyodide_callback","checkInterrupt","_PyErr_SetInterrupt","makePublicAPI","namespace","version","_module","public_api","saveState","_state","save_state","restoreState","state","restore_state","dump_traceback","__Py_DumpTraceback","_PyGILState_GetThisThreadState","runPythonInternal_dict","fatal_error_occurred","finalizeBootstrap","config","_pyodide","_base","runPythonInternal","sys","insert","homedir","builtins","builtins_dict","symbol","importhook","_importhook","register_js_finder","jsglobals","pyodide","__version__","loadPyodide","__pyodide_module","indexURL","inProgress","default_config","fullStdLib","prompt","packageIndexReady","package_json","fsPromises","package_string","readFile","JSON","parse","response","json","import_name","initializePackageIndex","pyodide_py_tar_promise","arrayBuffer","_fetchBinaryFile","mkdirTree","ENV","HOME","chdir","moduleLoaded","postRun","_createPyodideModule","pyodide_py_tar","stream","open","write","byteLength","close","code_ptr","stringToNewUTF8","_PyRun_SimpleString","_free","unlink","unpackPyodidePy","_pyodide_init","inTestHoist","enumerable","on_fatal","err2"],"mappings":"AAUO,IAAIA,OAAS,GAcb,SAASC,mBAAmBC,MAAOC,OAAQC,QAE5CD,SACFH,OAAOK,MAAQF,QAGbC,SACFJ,OAAOM,SAAWF,QAIhBF,OACFF,OAAOO,OAAOC,MAAK,WACjBR,OAAOS,GAAGC,KAKhB,SAA4BR,OAI1B,MAAMS,QAAU,IAAIC,YACpB,IAAIC,MAAQ,IAAIC,WAAW,GACvBC,YAAc,EAClB,SAASC,eACP,IACE,IAAoB,IAAhBD,WAAmB,CACrB,IAAIE,KAAOf,QACX,GAAIe,MAAAA,KACF,OAAO,KAET,GAAoB,iBAATA,KACT,MAAM,IAAIC,UACR,wEAAwED,SAGvEA,KAAKE,SAAS,QACjBF,MAAQ,MAEVJ,MAAQF,QAAQS,OAAOH,MACvBF,WAAa,EAGf,GAAIA,WAAaF,MAAMQ,OAAQ,CAC7B,IAAIC,UAAYT,MAAME,YAEtB,OADAA,aACOO,UAGP,OADAP,YAAc,EACP,KAET,MAAOQ,GAKP,MAFAC,QAAQC,MAAM,0BACdD,QAAQC,MAAMF,GACRA,GAGV,OAAOP,aA/CYU,CAAmBxB,OAAQ,KAAM,SA1BtDF,OAAO2B,iBAAkB,EACzB3B,OAAO4B,iBAAkB,EACzB5B,OAAO6B,gBAAiB,EACxB7B,OAAO8B,cAAgB,GACvB9B,OAAOO,OAAS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