{"version":3,"file":"pyodide.js","sources":["../src/js/node_modules/stackframe/stackframe.js","../src/js/node_modules/error-stack-parser/error-stack-parser.js","../src/js/compat.ts","../src/js/module.ts","../src/js/pyodide.ts","../src/js/version.ts","../src/js/pyodide.umd.ts"],"sourcesContent":["(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stackframe', [], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.StackFrame = factory();\n }\n}(this, function() {\n 'use strict';\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n\n function _getter(p) {\n return function() {\n return this[p];\n };\n }\n\n var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];\n var numericProps = ['columnNumber', 'lineNumber'];\n var stringProps = ['fileName', 'functionName', 'source'];\n var arrayProps = ['args'];\n var objectProps = ['evalOrigin'];\n\n var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);\n\n function StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this['set' + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n\n StackFrame.prototype = {\n getArgs: function() {\n return this.args;\n },\n setArgs: function(v) {\n if (Object.prototype.toString.call(v) !== '[object Array]') {\n throw new TypeError('Args must be an Array');\n }\n this.args = v;\n },\n\n getEvalOrigin: function() {\n return this.evalOrigin;\n },\n setEvalOrigin: function(v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError('Eval Origin must be an Object or StackFrame');\n }\n },\n\n toString: function() {\n var fileName = this.getFileName() || '';\n var lineNumber = this.getLineNumber() || '';\n var columnNumber = this.getColumnNumber() || '';\n var functionName = this.getFunctionName() || '';\n if (this.getIsEval()) {\n if (fileName) {\n return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return '[eval]:' + lineNumber + ':' + columnNumber;\n }\n if (functionName) {\n return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return fileName + ':' + lineNumber + ':' + columnNumber;\n }\n };\n\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf('(');\n var argsEndIndex = str.lastIndexOf(')');\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf('@') === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, '');\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {\n return function(v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n }\n\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {\n return function(v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + ' must be a Number');\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n }\n\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {\n return function(v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n }\n\n return StackFrame;\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('error-stack-parser', ['stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('stackframe'));\n } else {\n root.ErrorStackParser = factory(root.StackFrame);\n }\n}(this, function ErrorStackParser(StackFrame) {\n 'use strict';\n\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n\n return result;\n },\n\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n\n return result;\n },\n\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(//, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n}));\n","// Detect if we're in node\ndeclare var process: any;\n\nexport const 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\nlet nodeUrlMod: any;\nlet nodeFetch: any;\nlet nodePath: any;\nlet nodeVmMod: any;\n/** @private */\nexport let nodeFsPromisesMod: any;\n\ndeclare var globalThis: {\n importScripts: (url: string) => void;\n document?: any;\n fetch?: any;\n};\n\n/**\n * If we're in node, it's most convenient to import various node modules on\n * initialization. Otherwise, this does nothing.\n * @private\n */\nexport async function initNodeModules() {\n if (!IN_NODE) {\n return;\n }\n // @ts-ignore\n nodeUrlMod = (await import(\"url\")).default;\n nodeFsPromisesMod = await import(\"fs/promises\");\n if (globalThis.fetch) {\n nodeFetch = fetch;\n } else {\n // @ts-ignore\n nodeFetch = (await import(\"node-fetch\")).default;\n }\n // @ts-ignore\n nodeVmMod = (await import(\"vm\")).default;\n nodePath = await import(\"path\");\n pathSep = nodePath.sep;\n\n // Emscripten uses `require`, so if it's missing (because we were imported as\n // an ES6 module) we need to polyfill `require` with `import`. `import` is\n // async and `require` is synchronous, so we import all packages that might be\n // required up front and define require to look them up in this table.\n\n if (typeof require !== \"undefined\") {\n return;\n }\n // These are all the packages required in pyodide.asm.js. You can get this\n // list with:\n // $ grep -o 'require(\"[a-z]*\")' pyodide.asm.js | sort -u\n const fs = await import(\"fs\");\n const crypto = await import(\"crypto\");\n const ws = await import(\"ws\");\n const child_process = await import(\"child_process\");\n const node_modules: { [mode: string]: any } = {\n fs,\n crypto,\n ws,\n child_process,\n };\n // Since we're in an ES6 module, this is only modifying the module namespace,\n // it's still private to Pyodide.\n (globalThis as any).require = function (mod: string): any {\n return node_modules[mod];\n };\n}\n\nfunction node_resolvePath(path: string, base?: string): string {\n return nodePath.resolve(base || \".\", path);\n}\n\nfunction browser_resolvePath(path: string, base?: string): string {\n if (base === undefined) {\n // @ts-ignore\n base = location;\n }\n return new URL(path, base).toString();\n}\n\nexport let resolvePath: (rest: string, base?: string) => string;\nif (IN_NODE) {\n resolvePath = node_resolvePath;\n} else {\n resolvePath = browser_resolvePath;\n}\n\n/**\n * Get the path separator. If we are on Linux or in the browser, it's /.\n * In Windows, it's \\.\n * @private\n */\nexport let pathSep: string;\n\nif (!IN_NODE) {\n pathSep = \"/\";\n}\n\n/**\n * Load a binary file, only for use in Node. If the path explicitly is a URL,\n * then fetch from a URL, else load from the file system.\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param checksum sha-256 checksum of the package\n * @returns An ArrayBuffer containing the binary data\n * @private\n */\nasync function node_loadBinaryFile(\n path: string,\n _file_sub_resource_hash?: string | undefined // Ignoring sub resource hash. See issue-2431.\n): Promise {\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n let response = await nodeFetch(path);\n if (!response.ok) {\n throw new Error(`Failed to load '${path}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n } else {\n // Otherwise get it from the file system\n const data = await nodeFsPromisesMod.readFile(path);\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n}\n\n/**\n * Load a binary file, only for use in browser. Resolves relative paths against\n * indexURL.\n *\n * @param path the path to load\n * @param subResourceHash the sub resource hash for fetch() integrity check\n * @returns A Uint8Array containing the binary data\n * @private\n */\nasync function browser_loadBinaryFile(\n path: string,\n subResourceHash: string | undefined\n): Promise {\n // @ts-ignore\n const url = new URL(path, location);\n let options = subResourceHash ? { integrity: subResourceHash } : {};\n // @ts-ignore\n let response = await fetch(url, options);\n if (!response.ok) {\n throw new Error(`Failed to load '${url}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n}\n\n/** @private */\nexport let loadBinaryFile: (\n path: string,\n file_sub_resource_hash?: string | undefined\n) => Promise;\nif (IN_NODE) {\n loadBinaryFile = node_loadBinaryFile;\n} else {\n loadBinaryFile = browser_loadBinaryFile;\n}\n\n/**\n * Currently loadScript is only used once to load `pyodide.asm.js`.\n * @param url\n * @async\n * @private\n */\nexport let loadScript: (url: string) => Promise;\n\nif (globalThis.document) {\n // browser\n loadScript = async (url) => await import(url);\n} else if (globalThis.importScripts) {\n // webworker\n loadScript = async (url) => {\n try {\n // use importScripts in classic web worker\n globalThis.importScripts(url);\n } catch (e) {\n // importScripts throws TypeError in a module type web worker, use import instead\n if (e instanceof TypeError) {\n await import(url);\n } else {\n throw e;\n }\n }\n };\n} else if (IN_NODE) {\n loadScript = nodeLoadScript;\n} else {\n throw new Error(\"Cannot determine runtime environment\");\n}\n\n/**\n * Load a text file and executes it as Javascript\n * @param url The path to load. May be a url or a relative file system path.\n * @private\n */\nasync function nodeLoadScript(url: string) {\n if (url.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n url = url.slice(\"file://\".length);\n }\n if (url.includes(\"://\")) {\n // If it's a url, load it with fetch then eval it.\n nodeVmMod.runInThisContext(await (await nodeFetch(url)).text());\n } else {\n // Otherwise, hopefully it is a relative path we can load from the file\n // system.\n await import(nodeUrlMod.pathToFileURL(url).href);\n }\n}\n","/** @private */\nexport interface Module {\n noImageDecoding: boolean;\n noAudioDecoding: boolean;\n noWasmDecoding: boolean;\n preRun: { (): void }[];\n print: (a: string) => void;\n printErr: (a: string) => void;\n ENV: { [key: string]: string };\n preloadedWasm: any;\n FS: any;\n}\n\n/**\n * The Emscripten Module.\n *\n * @private\n */\nexport function createModule(): any {\n let Module: any = {};\n Module.noImageDecoding = true;\n Module.noAudioDecoding = true;\n Module.noWasmDecoding = false; // we preload wasm using the built in plugin now\n Module.preloadedWasm = {};\n Module.preRun = [];\n return Module;\n}\n\n/**\n *\n * @param stdin\n * @param stdout\n * @param stderr\n * @private\n */\nexport function setStandardStreams(\n Module: Module,\n stdin?: () => string,\n stdout?: (a: string) => void,\n stderr?: (a: string) => void\n) {\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: () => string) {\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 path\n * @private\n */\nexport function setHomeDirectory(Module: Module, path: string) {\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","/**\n * The main bootstrap code for loading pyodide.\n */\nimport ErrorStackParser from \"error-stack-parser\";\nimport {\n loadScript,\n loadBinaryFile,\n initNodeModules,\n pathSep,\n resolvePath,\n} from \"./compat\";\n\nimport { createModule, setStandardStreams, setHomeDirectory } from \"./module\";\nimport version from \"./version\";\n\nimport type { PyodideInterface } from \"./api.js\";\nimport type { PyProxy, PyProxyDict } from \"./pyproxy.gen\";\nexport type { PyodideInterface };\n\nexport type {\n PyProxy,\n PyProxyWithLength,\n PyProxyDict,\n PyProxyWithGet,\n PyProxyWithSet,\n PyProxyWithHas,\n PyProxyIterable,\n PyProxyIterator,\n PyProxyAwaitable,\n PyProxyBuffer,\n PyProxyCallable,\n TypedArray,\n PyBuffer,\n} from \"./pyproxy.gen\";\n\nexport type Py2JsResult = any;\n\nexport { version };\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(\n globals_dict: PyProxyDict,\n builtins_dict: PyProxyDict\n) {\n return new Proxy(globals_dict, {\n get(target, symbol) {\n if (symbol === \"get\") {\n return (key: any) => {\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: any) => target.has(key) || builtins_dict.has(key);\n }\n return Reflect.get(target, symbol);\n },\n });\n}\n\nfunction unpackPyodidePy(Module: any, pyodide_py_tar: Uint8Array) {\n const fileName = \"/pyodide_py.tar\";\n let stream = Module.FS.open(fileName, \"w\");\n Module.FS.write(\n stream,\n 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(`\nfrom sys import version_info\npyversion = f\"python{version_info.major}.{version_info.minor}\"\nimport shutil\nshutil.unpack_archive(\"/pyodide_py.tar\", f\"/lib/{pyversion}/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(API: any, config: ConfigType) {\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 API.runPythonInternal_dict = API._pyodide._base.eval_code(\"{}\") as PyProxy;\n API.importlib = API.runPythonInternal(\"import importlib; importlib\");\n let import_module = API.importlib.import_module;\n\n API.sys = import_module(\"sys\");\n API.sys.path.insert(0, config.homedir);\n\n // Set up globals\n let globals = API.runPythonInternal(\n \"import __main__; __main__.__dict__\"\n ) as PyProxyDict;\n let builtins = API.runPythonInternal(\n \"import builtins; builtins.__dict__\"\n ) as PyProxyDict;\n API.globals = wrapPythonGlobals(globals, builtins);\n\n // Set up key Javascript modules.\n let importhook = API._pyodide._importhook;\n importhook.register_js_finder();\n importhook.register_js_module(\"js\", config.jsglobals);\n\n importhook.register_unvendored_stdlib_finder();\n\n let pyodide = API.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 API.pyodide_py = import_module(\"pyodide\");\n API.pyodide_code = import_module(\"pyodide.code\");\n API.pyodide_ffi = import_module(\"pyodide.ffi\");\n API.package_loader = import_module(\"pyodide._package_loader\");\n\n // copy some last constants onto public API.\n pyodide.pyodide_py = API.pyodide_py;\n pyodide.globals = API.globals;\n return pyodide;\n}\n\ndeclare function _createPyodideModule(Module: any): Promise;\n\n/**\n * If indexURL isn't provided, throw an error and catch it and then parse our\n * file name out from the stack trace.\n *\n * Question: But getting the URL from error stack trace is well... really\n * hacky. Can't we use\n * [`document.currentScript`](https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript)\n * or\n * [`import.meta.url`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta)\n * instead?\n *\n * Answer: `document.currentScript` works for the browser main thread.\n * `import.meta` works for es6 modules. In a classic webworker, I think there\n * is no approach that works. Also we would need some third approach for node\n * when loading a commonjs module using `require`. On the other hand, this\n * stack trace approach works for every case without any feature detection\n * code.\n */\nfunction calculateIndexURL(): string {\n if (typeof __dirname === \"string\") {\n return __dirname;\n }\n let err: Error;\n try {\n throw new Error();\n } catch (e) {\n err = e as Error;\n }\n let fileName = ErrorStackParser.parse(err)[0].fileName!;\n const indexOfLastSlash = fileName.lastIndexOf(pathSep);\n if (indexOfLastSlash === -1) {\n throw new Error(\n \"Could not extract indexURL path from pyodide module location\"\n );\n }\n return fileName.slice(0, indexOfLastSlash);\n}\n\n/**\n * See documentation for loadPyodide.\n * @private\n */\nexport type ConfigType = {\n indexURL: string;\n lockFileURL: string;\n homedir: string;\n fullStdLib?: boolean;\n stdin?: () => string;\n stdout?: (msg: string) => void;\n stderr?: (msg: string) => void;\n jsglobals?: object;\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 * `_.)\n *\n * @returns The :ref:`js-api-pyodide` module.\n * @memberof globalThis\n * @async\n */\nexport async function loadPyodide(\n options: {\n /**\n * The URL from which Pyodide will load the main Pyodide runtime and\n * packages. Defaults to the url that pyodide is loaded from with the file\n * name (pyodide.js or pyodide.mjs) removed. It is recommended that you\n * leave this undefined, providing an incorrect value can cause broken\n * behavior.\n */\n indexURL?: string;\n\n /**\n * The URL from which Pyodide will load the Pyodide \"repodata.json\" lock\n * file. Defaults to ``${indexURL}/repodata.json``. You can produce custom\n * lock files with :any:`micropip.freeze`\n */\n lockFileURL?: string;\n\n /**\n * The home directory which Pyodide will use inside virtual file system. Default: \"/home/pyodide\"\n */\n homedir?: string;\n\n /** Load the full Python standard library.\n * Setting this to false excludes following modules: distutils.\n * Default: true\n */\n fullStdLib?: boolean;\n /**\n * Override the standard input callback. Should ask the user for one line of input.\n */\n stdin?: () => string;\n /**\n * Override the standard output callback.\n * Default: undefined\n */\n stdout?: (msg: string) => void;\n /**\n * Override the standard error output callback.\n * Default: undefined\n */\n stderr?: (msg: string) => void;\n jsglobals?: object;\n } = {}\n): Promise {\n await initNodeModules();\n let indexURL = options.indexURL || calculateIndexURL();\n indexURL = resolvePath(indexURL); // A relative indexURL causes havoc.\n if (!indexURL.endsWith(\"/\")) {\n indexURL += \"/\";\n }\n options.indexURL = indexURL;\n\n const default_config = {\n fullStdLib: true,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? globalThis.prompt : undefined,\n homedir: \"/home/pyodide\",\n lockFileURL: indexURL! + \"repodata.json\",\n };\n const config = Object.assign(default_config, options) as ConfigType;\n const pyodide_py_tar_promise = loadBinaryFile(\n config.indexURL + \"pyodide_py.tar\"\n );\n\n const Module = createModule();\n const API: any = { config };\n Module.API = API;\n\n setStandardStreams(Module, config.stdin, config.stdout, config.stderr);\n setHomeDirectory(Module, config.homedir);\n\n const moduleLoaded = new Promise((r) => (Module.postRun = r));\n\n // locateFile tells Emscripten where to find the data files that initialize\n // the file system.\n Module.locateFile = (path: string) => config.indexURL + path;\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 if (API.version !== version) {\n throw new Error(\n `\\\nPyodide version does not match: '${version}' <==> '${API.version}'. \\\nIf you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.\\\n`\n );\n }\n\n // Disable further loading of Emscripten file_packager stuff.\n Module.locateFile = (path: string) => {\n throw new Error(\"Didn't expect to load any more file_packager files!\");\n };\n\n const pyodide_py_tar = await pyodide_py_tar_promise;\n unpackPyodidePy(Module, pyodide_py_tar);\n Module._pyodide_init();\n\n const pyodide = finalizeBootstrap(API, config);\n\n // API.runPython works starting here.\n if (!pyodide.version.includes(\"dev\")) {\n // Currently only used in Node to download packages the first time they are\n // loaded. But in other cases it's harmless.\n API.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${pyodide.version}/full/`);\n }\n await API.packageIndexReady;\n if (API.repodata_info.version !== version) {\n throw new Error(\"Lock file version doesn't match Pyodide version\");\n }\n if (config.fullStdLib) {\n await pyodide.loadPackage([\"distutils\"]);\n }\n pyodide.runPython(\"print('Python initialization complete')\");\n return pyodide;\n}\n","/**\n *\n * The Pyodide version.\n *\n * The version here follows PEP440 which is different from the one in package.json,\n * as we want to compare this with the version of Pyodide Python package without conversion.\n */\nconst version: string = \"0.21.3\";\n\nexport default version;\n","import { loadPyodide, version } from \"./pyodide\";\nexport { loadPyodide, version };\n(globalThis as any).loadPyodide = loadPyodide;\n"],"names":["module","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","this","booleanProps","numericProps","stringProps","arrayProps","objectProps","props","concat","StackFrame","obj","i","length","undefined","prototype","getArgs","args","setArgs","v","Object","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","fileName","getFileName","lineNumber","getLineNumber","columnNumber","getColumnNumber","functionName","getFunctionName","getIsEval","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","split","locationString","parts","exec","Boolean","j","Number","k","String","factory","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","require$$0","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","replace","filter","line","map","sanitizedLine","location","locationParts","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","push","argsRaw","tokens","pop","functionCall","shift","IN_NODE","process","release","name","browser","nodeUrlMod","nodeFetch","nodePath","nodeVmMod","nodeFsPromisesMod","resolvePath","pathSep","loadBinaryFile","loadScript","path","base","resolve","URL","async","_file_sub_resource_hash","startsWith","slice","includes","response","ok","Uint8Array","arrayBuffer","data","readFile","buffer","byteOffset","byteLength","subResourceHash","url","options","integrity","fetch","globalThis","document","import","importScripts","runInThisContext","text","pathToFileURL","href","setStandardStreams","Module","stdin","stdout","stderr","print","printErr","preRun","FS","init","encoder","TextEncoder","input","inputIndex","stdinWrapper","endsWith","encode","character","console","createStdinWrapper","finalizeBootstrap","API","config","runPythonInternal_dict","_pyodide","_base","eval_code","importlib","runPythonInternal","import_module","sys","insert","homedir","globals","builtins","builtins_dict","Proxy","get","target","symbol","key","has","Reflect","importhook","_importhook","register_js_finder","register_js_module","jsglobals","register_unvendored_stdlib_finder","pyodide","makePublicAPI","pyodide_py","pyodide_code","pyodide_ffi","package_loader","loadPyodide","default","sep","require","node_modules","fs","crypto","ws","child_process","mod","initNodeModules","indexURL","__dirname","err","ErrorStackParser","indexOfLastSlash","calculateIndexURL","default_config","fullStdLib","prompt","lockFileURL","assign","pyodide_py_tar_promise","mkdirTree","ENV","HOME","chdir","setHomeDirectory","moduleLoaded","Promise","r","postRun","locateFile","scriptSrc","_createPyodideModule","version","pyodide_py_tar","stream","open","write","close","code_ptr","stringToNewUTF8","_PyRun_SimpleString","_free","unlink","unpackPyodidePy","_pyodide_init","setCdnUrl","packageIndexReady","repodata_info","loadPackage","runPython"],"mappings":"igBAQQA,eAIA,WAEJ,SAASC,UAAUC,GACf,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG7C,SAASI,YAAYC,KACjB,OAAOA,IAAIC,OAAO,GAAGC,cAAgBF,IAAIG,UAAU,GAGvD,SAASC,QAAQC,GACb,OAAO,WACH,OAAOC,KAAKD,IAIpB,IAAIE,aAAe,CAAC,gBAAiB,SAAU,WAAY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