open-webui/static/pyodide/pyodide.js

15 lines
16 KiB
JavaScript
Raw Normal View History

"use strict";var loadPyodide=(()=>{var ce=Object.create;var b=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var f=(t,e)=>b(t,"name",{value:e,configurable:!0}),y=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,c)=>(typeof require<"u"?require:e)[c]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),pe=(t,e)=>{for(var c in e)b(t,c,{get:e[c],enumerable:!0})},M=(t,e,c,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of de(e))!ue.call(t,a)&&a!==c&&b(t,a,{get:()=>e[a],enumerable:!(o=le(e,a))||o.enumerable});return t};var v=(t,e,c)=>(c=t!=null?ce(fe(t)):{},M(e||!t||!t.__esModule?b(c,"default",{value:t,enumerable:!0}):c,t)),me=t=>M(b({},"__esModule",{value:!0}),t);var C=$((k,U)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof k=="object"?U.exports=e():t.StackFrame=e()})(k,function(){"use strict";function t(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");function e(d){return d.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");function c(d){return function(){return this[d]}}f(c,"_getter");var o=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=o.concat(a,r,n,u);function s(d){if(d)for(var g=0;g<i.length;g++)d[i[g]]!==void 0&&this["set"+e(i[g])](d[i[g]])}f(s,"StackFrame"),s.prototype={getArgs:function(){return this.args},setArgs:function(d){if(Object.prototype.toString.call(d)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=d},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(d){if(d instanceof s)this.evalOrigin=d;else if(d instanceof Object)this.evalOrigin=new s(d);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var d=this.getFileName()||"",g=this.getLineNumber()||"",w=this.getColumnNumber()||"",_=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+g+":"+w+")":"[eval]:"+g+":"+w:_?_+" ("+d+":"+g+":"+w+")":d+":"+g+":"+w}},s.fromString=f(function(g){var w=g.indexOf("("),_=g.lastIndexOf(")"),ne=g.substring(0,w),ie=g.substring(w+1,_).split(","),T=g.substring(_+1);if(T.indexOf("@")===0)var R=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(T,""),oe=R[1],ae=R[2],se=R[3];return new s({functionName:ne,args:ie||void 0,fileName:oe,lineNumber:ae||void 0,columnNumber:se||void 0})},"StackFrame$$fromString");for(var l=0;l<o.length;l++)s.prototype["get"+e(o[l])]=c(o[l]),s.prototype["set"+e(o[l])]=function(d){return function(g){this[d]=!!g}}(o[l]);for(var m=0;m<a.length;m++)s.prototype["get"+e(a[m])]=c(a[m]),s.prototype["set"+e(a[m])]=function(d){return function(g){if(!t(g))throw new TypeError(d+" must be a Number");this[d]=Number(g)}}(a[m]);for(var p=0;p<r.length;p++)s.prototype["get"+e(r[p])]=c(r[p]),s.prototype["set"+e(r[p])]=function(d){return function(g){this[d]=String(g)}}(r[p]);return s})});var W=$((x,B)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof x=="object"?B.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(x,f(function(e){"use strict";var c=/(^|@)\S+:\d+/,o=/^\s*at .*(\S+:\d+|\(native\))/m,a=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(o))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(n){if(n.indexOf(":")===-1)return[n];var u=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(n){var u=n.stack.split(`
2024-05-17 03:49:28 +00:00
`).filter(function(i){return!!i.match(o)},this);return u.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var s=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=s.match(/ (\(.+\)$)/);s=l?s.replace(l[0],""):s;var m=this.extractLocation(l?l[1]:s),p=l&&s||void 0,d=["eval","<anonymous>"].indexOf(m[0])>-1?void 0:m[0];return new e({functionName:p,fileName:d,lineNumber:m[1],columnNumber:m[2],source:i})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:f(function(n){var u=n.stack.split(`
`).filter(function(i){return!i.match(a)},this);return u.map(function(i){if(i.indexOf(" > eval")>-1&&(i=i.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),i.indexOf("@")===-1&&i.indexOf(":")===-1)return new e({functionName:i});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=i.match(s),m=l&&l[1]?l[1]:void 0,p=this.extractLocation(i.replace(s,""));return new e({functionName:m,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:f(function(n){return!n.stacktrace||n.message.indexOf(`
`)>-1&&n.message.split(`
`).length>n.stacktrace.split(`
`).length?this.parseOpera9(n):n.stack?this.parseOpera11(n):this.parseOpera10(n)},"ErrorStackParser$$parseOpera"),parseOpera9:f(function(n){for(var u=/Line (\d+).*script (?:in )?(\S+)/i,i=n.message.split(`
`),s=[],l=2,m=i.length;l<m;l+=2){var p=u.exec(i[l]);p&&s.push(new e({fileName:p[2],lineNumber:p[1],source:i[l]}))}return s},"ErrorStackParser$$parseOpera9"),parseOpera10:f(function(n){for(var u=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=n.stacktrace.split(`
`),s=[],l=0,m=i.length;l<m;l+=2){var p=u.exec(i[l]);p&&s.push(new e({functionName:p[3]||void 0,fileName:p[2],lineNumber:p[1],source:i[l]}))}return s},"ErrorStackParser$$parseOpera10"),parseOpera11:f(function(n){var u=n.stack.split(`
`).filter(function(i){return!!i.match(c)&&!i.match(/^Error created at/)},this);return u.map(function(i){var s=i.split("@"),l=this.extractLocation(s.pop()),m=s.shift()||"",p=m.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,d;m.match(/\(([^)]*)\)/)&&(d=m.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var g=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:g,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Re={};pe(Re,{loadPyodide:()=>D,version:()=>E});var K=v(W());var h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",P=h&&typeof module<"u"&&typeof module.exports<"u"&&typeof y<"u"&&typeof __dirname<"u",j=h&&!P,ge=typeof Deno<"u",H=!h&&!ge,z=H&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u"&&typeof importScripts>"u",q=H&&typeof importScripts<"u"&&typeof self<"u",Fe=typeof navigator<"u"&&typeof navigator.userAgent<"u"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var J,F,X,V,I;async function L(){if(!h||(J=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),I=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,F=await import(/* webpackIgnore */"node:path"),A=F.sep,typeof y<"u"))return;let t=V,e=await import(/* webpackIgnore */"node:crypto"),c=await import(/* webpackIgnore */"ws"),o=await import(/* webpackIgnore */"node:child_process"),a={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return a[r]}}f(L,"initNodeModules");function ye(t,e){return F.resolve(e||".",t)}f(ye,"node_resolvePath");function ve(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ve,"browser_resolvePath");var N;h?N=ye:N=ve;var A;h||(A="/");function he(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:I.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(he,"node_getBinaryResponse");function we(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(we,"browser_getBinaryResponse");var O;h?O=he:O=we;async function G(t,e){let{response:c,binary:o}=O(t,e);if(o)return o;let a=await c;if(!a.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await a.arrayBuffer())}f(G,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(h)S=Ee;else throw new Error("Cannot determine runtime environment");async function Ee(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?X.runInThisContext(await(await fetch(t)).text()):await import(/* webpackIgnore */J.pathToFileURL(t).href)}f(Ee,"nodeLoadScript");async function Y(t){if(h){await L();let e=await I.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(Y,"loadLockFile");async function Q(){if(P)return __dirname;let t;try{throw new Error}catch(o){t=o}let e=K.default.parse(t)[0].fileName;if(j){let o=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(A);if(c===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,c)}f(Q,"calculateDirname");function Z(t){let e=t.FS,c=t.FS.filesystems.MEMFS,o=t.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return c.mount.apply(null,arguments)},syncfs:async(r,n,u)=>{try{let i=a.getLocalSet(r),s=await a.getRemoteSet(r),l=n?s:i,m=n?i:s;await a.reconcile(r,l,m),u(null)}catch(i){u(i)}},getLocalSet:r=>{let n=Object.create(null);function u(l){return l!=="."&&l!==".."}f
lockfile version: ${r.lockfile_info.version}
pyodide version: ${E}`);return r.package_loader.init_loaded_packages(),o.fullStdLib&&await u.loadPackage(r.lockfile_unvendored_stdlibs),r.initializeStreams(o.stdin,o.stdout,o.stderr),u}f(D,"loadPyodide");globalThis.loadPyodide=D;return me(Re);})();
2024-05-17 03:49:28 +00:00
try{Object.assign(exports,loadPyodide)}catch(_){}
globalThis.loadPyodide=loadPyodide.loadPyodide;
//# sourceMappingURL=pyodide.js.map