@stlite/desktop 0.42.1 → 0.42.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dump_artifacts.js +4 -4
- package/build/asset-manifest.json +8 -8
- package/build/index.html +1 -1
- package/build/static/js/{3580.d19b48d7.chunk.js → 3580.31cb6ce5.chunk.js} +1 -1
- package/build/static/js/7332.dab24413.chunk.js +1 -0
- package/build/static/js/{787.1fed8465.chunk.js → 787.a500c8a4.chunk.js} +1 -1
- package/build/static/js/{792.846cbe01.chunk.js → 792.04aad606.chunk.js} +1 -1
- package/build/static/js/{9615.4af0ec9d.chunk.js → 9615.c725e9d2.chunk.js} +1 -1
- package/build/static/js/{9733.e7ca3cbc.chunk.js → 9733.e3808291.chunk.js} +2 -2
- package/build/static/js/main.890b94ab.js +28 -0
- package/package.json +4 -4
- package/build/static/js/7073.fde4a508.chunk.js +0 -1
- package/build/static/js/main.45f56acc.js +0 -28
- /package/build/static/js/{9733.e7ca3cbc.chunk.js.LICENSE.txt → 9733.e3808291.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.45f56acc.js.LICENSE.txt → main.890b94ab.js.LICENSE.txt} +0 -0
package/bin/dump_artifacts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}
|
|
2
|
+
var M=Object.create;var P=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var R=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of K(t))!J.call(e,a)&&a!==i&&P(e,a,{get:()=>t[a],enumerable:!(s=x(t,a))||s.enumerable});return e};var d=(e,t,i)=>(i=e!=null?M(W(e)):{},R(t||!e||!e.__esModule?P(i,"default",{value:e,enumerable:!0}):i,e));var D=y(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.parseRequirementsTxt=void 0;function C(e){return e.split(`
|
|
3
|
+
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}f.parseRequirementsTxt=C});var b=y(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.PromiseDelegate=void 0;var w=class{constructor(){this.promise=new Promise((t,i)=>{this.resolveInternal=t,this.rejectInternal=i})}resolve(t){this.resolveInternal(t)}reject(t){this.rejectInternal(t)}};g.PromiseDelegate=w});var q=y(p=>{"use strict";var E=p&&p.__createBinding||(Object.create?function(e,t,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(t,i);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,a)}:function(e,t,i,s){s===void 0&&(s=i),e[s]=t[i]}),_=p&&p.__exportStar||function(e,t){for(var i in e)i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&E(t,e,i)};Object.defineProperty(p,"__esModule",{value:!0});_(D(),p);_(b(),p)});var $=d(require("yargs")),j=require("yargs/helpers"),r=d(require("path")),n=d(require("fs/promises")),k=d(require("fs-extra")),u=d(require("node-fetch")),m=require("pyodide"),T=d(q());global.fetch=u.default;function B(e){return`https://cdn.jsdelivr.net/pyodide/v${m.version}/full/${e}`}async function L(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=r.default.resolve(__dirname,"../build");if(!(await n.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await n.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await n.default.rm(e.copyTo,{recursive:!0,force:!0}),await k.default.copy(t,e.copyTo)}async function H(e){if(e.requirements.length===0)return[];let t=await(0,m.loadPyodide)();await t.loadPackage("micropip");let i=t.pyimport("micropip");return i.add_mock_package("streamlit","1.24.0"),await i.install(e.requirements),Object.entries(t.loadedPackages).filter(([,s])=>s==="default channel").map(([s])=>s)}async function F(){let e=B("repodata.json");return console.log(`Load the Pyodide repodata.json from ${e}`),(await(await(0,u.default)(e)).json()).packages}async function O(e,t){console.log(`Install the local wheel ${t}`);let i=await n.default.readFile(t),s="/tmp/"+r.default.basename(t);e.FS.writeFile(s,i);let a=e.pyimport("micropip"),c=`emfs:${s}`;console.log(`Install ${c}`),await a.install.callKwargs(c,{keep_going:!0})}async function U(e){console.info("Create the site-packages snapshot file...");let t=await(0,m.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let l=r.default.dirname(require.resolve("@stlite/kernel")),o=r.default.resolve(l,"../py");await O(t,r.default.join(o,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await O(t,r.default.join(o,"streamlit/lib/dist/streamlit-1.24.0-cp311-none-any.whl"))}else{let o=require(r.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${o}/flat`,v=(await(await(0,u.default)(S)).json()).files.filter(h=>h.name.endsWith(".whl")).map(h=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${o}${h.name}`),I=t.pyimport("micropip");console.log("Install",v),await I.install.callKwargs(v,{keep_going:!0})}let i=t.pyimport("micropip"),s=await F();e.usedBuiltinPackages.length>0&&(console.log("Mocking builtin packages so that they will not be included in the site-packages snapshot because these will be installed from the vendored wheel files at runtime..."),e.usedBuiltinPackages.forEach(l=>{let o=s[l];if(o==null)throw new Error(`Package ${l} is not found in the lock file.`);console.log(`Mock ${o.name} ${o.version}`),i.add_mock_package(o.name,o.version)})),console.log(`Install the requirements ${JSON.stringify(e.requirements)}`),await i.install.callKwargs(e.requirements,{keep_going:!0}),console.log("Archive the site-packages director(y|ies)");let a="/tmp/site-packages-snapshot.tar.gz";await t.runPythonAsync(`
|
|
4
4
|
import tarfile
|
|
5
5
|
import site
|
|
6
6
|
|
|
@@ -10,5 +10,5 @@ var j=Object.create;var w=Object.defineProperty;var F=Object.getOwnPropertyDescr
|
|
|
10
10
|
with tarfile.open(tar_file_name, mode='w:gz') as gzf:
|
|
11
11
|
for site_packages in site_packages_dirs:
|
|
12
12
|
gzf.add(site_packages)
|
|
13
|
-
`),console.log("Extract the archive file from EMFS");let
|
|
14
|
-
`);await n.default.writeFile(e,i,{encoding:"utf-8"})}function
|
|
13
|
+
`),console.log("Extract the archive file from EMFS");let c=t.FS.readFile(a);console.log(`Save the archive file (${e.saveTo})`),await n.default.writeFile(e.saveTo,c)}async function A(e){console.info("Copy the Streamlit app directory..."),console.log(`Copy ${e.sourceDir} to ${e.copyTo}`),await n.default.rm(e.copyTo,{recursive:!0,force:!0}),await k.default.copy(e.sourceDir,e.copyTo)}async function z(e){let t=await n.default.readFile(e,{encoding:"utf-8"});return(0,T.parseRequirementsTxt)(t)}async function N(e,t){let i=t.join(`
|
|
14
|
+
`);await n.default.writeFile(e,i,{encoding:"utf-8"})}function V(e){e.forEach(t=>{let i;try{i=new URL(t)}catch{return}if(i.protocol==="emfs:"||i.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)})}async function G(e){let t=await F(),s=e.packages.map(a=>t[a]).map(a=>B(a.file_name));console.log("Downloading the used built-in packages..."),await Promise.all(s.map(async a=>{let c=r.default.resolve(e.destDir,"./pyodide",r.default.basename(a));console.log(`Download ${a} to ${c}`);let l=await(0,u.default)(a);if(!l.ok)throw new Error(`Failed to download ${a}: ${l.status} ${l.statusText}`);let o=await l.arrayBuffer();await n.default.writeFile(c,Buffer.from(o))}))}async function Q(e){let s={embed:(require(e.packageJsonPath).stlite?.desktop||{}).embed||!1},a=JSON.stringify(s,null,2);console.log(`Dump the manifest file -> ${e.manifestFilePath}`),console.log(a),await n.default.writeFile(e.manifestFilePath,a,{encoding:"utf-8"})}(0,$.default)((0,j.hideBin)(process.argv)).command("* <appHomeDirSource> [packages..]","Put the user code and data and the snapshot of the required packages into the build artifact.",()=>{},e=>{console.info(e)}).positional("appHomeDirSource",{describe:"The source directory of the user code and data that will be mounted in the Pyodide file system at app runtime",type:"string",demandOption:!0}).positional("packages",{describe:"Package names to install.",type:"string",array:!0}).options("requirement",{describe:"Install from the given requirements file. This option can be used multiple times.",array:!0,type:"string",alias:"r",default:[]}).options("localKernelWheels",{describe:"Use the locally installed kernel wheels",type:"boolean",alias:"l",default:!1}).options("keepOldBuild",{type:"boolean",default:!1,alias:"k",describe:"Keep the existing build directory contents except appHomeDir."}).parseAsync().then(async e=>{let t=process.cwd(),i=r.default.resolve(t,"./build");try{await n.default.access(e.appHomeDirSource)}catch{throw new Error(`${e.appHomeDirSource} does not exist.`)}let s=e.packages;for(let c of e.requirement)s=s.concat(await z(c));V(s);let a=await H({requirements:s,useLocalKernelWheels:e.localKernelWheels});console.log("The built-in packages loaded for the given requirements:"),console.log(a),await L({copyTo:i,keepOld:e.keepOldBuild}),await U({useLocalKernelWheels:e.localKernelWheels,requirements:s,usedBuiltinPackages:a,saveTo:r.default.resolve(i,"./site-packages-snapshot.tar.gz")}),await N(r.default.resolve(i,"./requirements.txt"),s),await A({sourceDir:e.appHomeDirSource,copyTo:r.default.resolve(i,"./streamlit_app")}),await G({packages:a,destDir:i}),await Q({packageJsonPath:r.default.resolve(t,"./package.json"),manifestFilePath:r.default.resolve(i,"./stlite-manifest.json")})});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/static/css/main.73ab603a.css",
|
|
4
|
-
"main.js": "/static/js/main.
|
|
5
|
-
"static/js/
|
|
4
|
+
"main.js": "/static/js/main.890b94ab.js",
|
|
5
|
+
"static/js/7332.dab24413.chunk.js": "/static/js/7332.dab24413.chunk.js",
|
|
6
6
|
"static/js/4994.551c87ac.chunk.js": "/static/js/4994.551c87ac.chunk.js",
|
|
7
7
|
"static/js/3685.c65c1e48.chunk.js": "/static/js/3685.c65c1e48.chunk.js",
|
|
8
|
-
"static/js/792.
|
|
8
|
+
"static/js/792.04aad606.chunk.js": "/static/js/792.04aad606.chunk.js",
|
|
9
9
|
"static/js/4141.623ab362.chunk.js": "/static/js/4141.623ab362.chunk.js",
|
|
10
10
|
"static/js/6913.30734208.chunk.js": "/static/js/6913.30734208.chunk.js",
|
|
11
11
|
"static/css/5099.60b7ada4.chunk.css": "/static/css/5099.60b7ada4.chunk.css",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"static/js/8418.aed275df.chunk.js": "/static/js/8418.aed275df.chunk.js",
|
|
17
17
|
"static/js/8295.c3cd87de.chunk.js": "/static/js/8295.c3cd87de.chunk.js",
|
|
18
18
|
"static/js/8486.e56533d6.chunk.js": "/static/js/8486.e56533d6.chunk.js",
|
|
19
|
-
"static/js/9615.
|
|
19
|
+
"static/js/9615.c725e9d2.chunk.js": "/static/js/9615.c725e9d2.chunk.js",
|
|
20
20
|
"static/js/6557.fd2f35c8.chunk.js": "/static/js/6557.fd2f35c8.chunk.js",
|
|
21
21
|
"static/js/9382.c417d448.chunk.js": "/static/js/9382.c417d448.chunk.js",
|
|
22
|
-
"static/js/3580.
|
|
22
|
+
"static/js/3580.31cb6ce5.chunk.js": "/static/js/3580.31cb6ce5.chunk.js",
|
|
23
23
|
"static/js/2327.b8572a38.chunk.js": "/static/js/2327.b8572a38.chunk.js",
|
|
24
|
-
"static/js/787.
|
|
24
|
+
"static/js/787.a500c8a4.chunk.js": "/static/js/787.a500c8a4.chunk.js",
|
|
25
25
|
"static/js/5241.0326c97c.chunk.js": "/static/js/5241.0326c97c.chunk.js",
|
|
26
26
|
"static/js/172.0ee3e7c6.chunk.js": "/static/js/172.0ee3e7c6.chunk.js",
|
|
27
27
|
"static/js/4140.edb6c36a.chunk.js": "/static/js/4140.edb6c36a.chunk.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"static/js/4320.5977ee6b.chunk.js": "/static/js/4320.5977ee6b.chunk.js",
|
|
50
50
|
"static/js/1579.30acb4ad.chunk.js": "/static/js/1579.30acb4ad.chunk.js",
|
|
51
51
|
"static/js/3744.6440bac0.chunk.js": "/static/js/3744.6440bac0.chunk.js",
|
|
52
|
-
"static/js/9733.
|
|
52
|
+
"static/js/9733.e3808291.chunk.js": "/static/js/9733.e3808291.chunk.js",
|
|
53
53
|
"static/js/865.9e23130b.chunk.js": "/static/js/865.9e23130b.chunk.js",
|
|
54
54
|
"static/js/3975.5538132d.chunk.js": "/static/js/3975.5538132d.chunk.js",
|
|
55
55
|
"static/js/142.3d0fb3e3.chunk.js": "/static/js/142.3d0fb3e3.chunk.js",
|
|
@@ -156,6 +156,6 @@
|
|
|
156
156
|
},
|
|
157
157
|
"entrypoints": [
|
|
158
158
|
"static/css/main.73ab603a.css",
|
|
159
|
-
"static/js/main.
|
|
159
|
+
"static/js/main.890b94ab.js"
|
|
160
160
|
]
|
|
161
161
|
}
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.890b94ab.js"></script><link href="/static/css/main.73ab603a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3580],{83580:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(5057),a=r(98927),n=r(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3580],{83580:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(5057),a=r(98927),n=r(99960),i=r(96266);const l=528;function d({element:e,width:t,endpoints:r}){const d=(0,s.useRef)(null),{type:o,url:c}=e,u=(0,n.O0)(c);(0,s.useEffect)((()=>{const t=d.current,r=()=>{t&&(t.currentTime=e.startTime)};return t&&t.addEventListener("loadedmetadata",r),()=>{t&&t.removeEventListener("loadedmetadata",r)}}),[e]);const h=t=>{const{startTime:r}=e;return r?`${t}?start=${r}`:t};if(o===a.nk.Type.YOUTUBE_IFRAME){const e=0!==t?.75*t:l;return(0,i.jsx)("iframe",{title:u,src:h(u),width:t,height:e,frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})}return(0,i.jsx)("video",{ref:d,controls:!0,src:r.buildMediaURL(u),className:"stVideo",style:{width:t,height:0===t?l:void 0}})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,a=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else{if(47===r)break;r=47}if(47===r){if(s===i-1||1===a);else if(s!==i-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),s=i,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=i,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,i):n=e.slice(s+1,i),o=i-s-1;s=i,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=a<l?a:l,d=-1,g=0;g<=c;++g){if(g===c){if(l>c){if(47===r.charCodeAt(i+g))return r.slice(i+g+1);if(0===g)return r.slice(i+g)}else a>c&&(47===e.charCodeAt(o+g)?d=g:0===g&&(d=0));break}var p=e.charCodeAt(o+g);if(p!==r.charCodeAt(i+g))break;47===p&&(d=g)}var h="";for(g=o+d+1;g<=s;++g)g!==s&&47!==e.charCodeAt(g)||(0===h.length?h+="..":h+="/..");return h.length>0?h+r.slice(i+d):(i+=d,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else-1===l&&(a=!1,l=n+1),i>=0&&(c===r.charCodeAt(i)?-1===--i&&(s=n):(i=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,a=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47!==l)-1===o&&(s=!1,o=i+1),46===l?-1===r?r=i:1!==a&&(a=1):-1!==r&&(a=-1);else if(!s){n=i+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var a=-1,i=0,l=-1,c=!0,d=e.length-1,g=0;d>=n;--d)if(47!==(o=e.charCodeAt(d)))-1===l&&(c=!1,l=d+1),46===o?-1===a?a=d:1!==g&&(g=1):-1!==a&&(g=-1);else if(!c){i=d+1;break}return-1===a||-1===l||0===g||1===g&&a===l-1&&a===i+1?-1!==l&&(r.base=r.name=0===i&&s?e.slice(1,l):e.slice(i,l)):(0===i&&s?(r.name=e.slice(1,a),r.base=e.slice(1,l)):(r.name=e.slice(i,a),r.base=e.slice(i,l)),r.ext=e.slice(a,l)),i>0?r.dir=e.slice(0,i-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e=r(56977),t=r.n(e);function n(e,r){const n=t().normalize(r),o=t().dirname(n).split("/"),s=[];for(const t of o){s.push(t);const r=s.join("/");if(e.FS.analyzePath(r).exists){if(e.FS.isDir(r))throw new Error(`"${r}" already exists and is not a directory.`)}else try{e.FS.mkdir(r)}catch(a){throw console.error(`Failed to create a directory "${r}"`),a}}}function o(e,t,r,o){n(e,t),e.FS.writeFile(t,r,o)}function s(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function a(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var i=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function a(e){try{l(n.next(e))}catch(t){s(t)}}function i(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}l((n=n.apply(e,t||[])).next())}))};let l,c;const d=self,g=new class{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};function p(e){d.postMessage({type:"event:progress",data:{message:e}})}const h="https://cdn.jsdelivr.net/pyodide/v0.23.3/full/pyodide.js";const u=function(){return i(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,archives:r,requirements:n,wheels:u,mountedSitePackagesSnapshotFilePath:f,pyodideUrl:m=h,streamlitConfig:y}=yield g.promise;if(p("Loading Pyodide."),console.debug("Loading Pyodide"),l=yield function(e,t){return i(this,void 0,void 0,(function*(){const r=e.slice(0,e.lastIndexOf("/")+1);let n;return e.endsWith(".mjs")?n=(yield import(e)).loadPyodide:(importScripts(e),n=self.loadPyodide),n(Object.assign(Object.assign({},t),{indexURL:r}))}))}(m,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),p("Mounting files."),yield Promise.all(Object.keys(t).map((e=>i(this,void 0,void 0,(function*(){const r=t[e];let n;"url"in r?(console.debug(`Fetch a file from ${r.url}`),n=yield fetch(r.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=r.data;const{opts:s}=t[e];console.debug(`Write a file "${e}"`),o(l,e,n,s)}))))),p("Unpacking archives."),yield Promise.all(r.map((e=>i(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),l.unpackArchive(t,r,n)}))))),f)p("Restoring the snapshot."),yield l.runPythonAsync("import tarfile, shutil, site"),yield l.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${f}`),yield l.runPythonAsync(`\n with tarfile.open("${f}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),p("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow");else{if(!u)throw new Error("Neither snapshot nor wheel files are provided.");{p("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield l.loadPackage("micropip");const e=l.pyimport("micropip");yield e.install.callKwargs([u.stliteServer],{keep_going:!0}),yield e.install.callKwargs([u.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),p("Mocking some packages."),console.debug("Mock pyarrow"),a(l),console.debug("Mocked pyarrow")}}if(n.length>0){p("Installing the requirements."),console.debug("Installing the requirements:",n),s(n),yield l.loadPackage("micropip");const e=l.pyimport("micropip");yield e.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements:",n)}yield l.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),p("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield l.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),p("Setting up the loggers."),console.debug("Setting the loggers"),yield l.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield l.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),p("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield l.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),p("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),self.__streamlitFlagOptions__=Object.assign(Object.assign({},y),{"browser.gatherUsageStats":!1,"runner.fastReruns":!1}),yield l.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n from js import __streamlitFlagOptions__\n\n flag_options = __streamlitFlagOptions__.to_py()\n load_config_options(flag_options)\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),c=l.globals.get("server").copy(),console.debug("Set up the HTTP server"),d.postMessage({type:"event:loaded"})}))}().catch((e=>{throw d.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>i(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void g.resolve(t.data);yield u;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;c.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);d.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else d.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;c.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const a={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(a)};c.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:s}=t.data;console.debug(`Write a file "${e}"`),o(l,e,n,s),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:o}=t.data;console.debug(`Rename "${e}" to ${o}`),function(e,t,r){n(e,r),e.FS.rename(t,r)}(l,e,o),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),l.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=l.pyimport("micropip");console.debug("Install the requirements:",e),s(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return l.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(a){if(console.error(a),!(a instanceof Error))throw a;const e=new Error(a.message);e.name=a.name,e.stack=a.stack,r.postMessage({type:"reply",error:e})}})),d.postMessage({type:"event:start"})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[787],{50787:(t,e,i)=>{i.r(e),i.d(e,{default:()=>r});i(5057);var l=i(46401),s=i(21807),d=i(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[787],{50787:(t,e,i)=>{i.r(e),i.d(e,{default:()=>r});i(5057);var l=i(46401),s=i(21807),d=i(99960),n=i(96266);const r=function(t){const{disabled:e,element:i,widgetMgr:r,width:a,endpoints:u}=t,o={width:a},c=(0,d.v_)();return(0,n.jsx)("div",{className:"row-widget stDownloadButton",style:o,children:(0,n.jsx)(l.t2,{help:i.help,children:(0,n.jsx)(l.ZP,{kind:l.nW.SECONDARY,size:l.V5.SMALL,disabled:e,onClick:()=>{if(r.setTriggerValue(i,{fromUi:!0}),i.url.startsWith("/media"))return void(0,d.uP)(c,i.url);const t=document.createElement("a"),e=u.buildMediaURL(i.url);t.setAttribute("href",e),t.setAttribute("target","_blank"),t.click()},fluidWidth:i.useContainerWidth||!1,children:(0,n.jsx)(s.Z,{source:i.label,allowHTML:!1,isLabel:!0,isButton:!0})})})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[792],{50792:(t,e,s)=>{s.r(e),s.d(e,{default:()=>l});var i=s(5057),u=s(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[792],{50792:(t,e,s)=>{s.r(e),s.d(e,{default:()=>l});var i=s(5057),u=s(99960),r=s(96266);function l({element:t,width:e,endpoints:s}){const l=(0,i.useRef)(null);(0,i.useEffect)((()=>{l.current&&(l.current.currentTime=t.startTime)}),[t.startTime]);const n=(0,u.O0)(t.url),a=s.buildMediaURL(n);return(0,r.jsx)("audio",{id:"audio",ref:l,controls:!0,src:a,className:"stAudio",style:{width:e}})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9615],{48610:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>u});e(5057);var o=e(89733),n=e(
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9615],{48610:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>u});e(5057);var o=e(89733),n=e(99960),d=e(82601),a=e(29241),r=e(45490);const l=(0,r.Z)("div",{target:"ebxwdo62"})((({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg})),""),s=(0,r.Z)("div",{target:"ebxwdo61"})((()=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0})),""),h=(0,r.Z)("div",{target:"ebxwdo60"})((({theme:t})=>({fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,color:t.colors.fadedText60,textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:"0.125rem"})),"");var c,g=e(96266);!function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth"}(c||(c={}));const u=(0,d.Z)((function({width:t,isFullScreen:i,element:e,height:d,endpoints:r}){const u=(0,n.$R)(e.imgs);let p;const m=e.width;if(m===c.OriginalWidth||m===c.AutoWidth)p=void 0;else if(m===c.ColumnWidth)p=t;else{if(!(m>0))throw Error(`Invalid image width: ${m}`);p=m}const w={};return d&&i?(w.maxHeight=d,w["object-fit"]="contain"):(w.width=p,m===c.AutoWidth&&(w.maxWidth="100%")),(0,g.jsx)(l,{style:{width:t},children:u.map(((t,i)=>{const e=t;return(0,g.jsxs)(s,{"data-testid":"stImage",children:[e.markup?(0,o.ZP)((0,a.kB)(e.markup)):(0,g.jsx)("img",{style:w,src:r.buildMediaURL(e.url),alt:i.toString()}),e.caption&&(0,g.jsx)(h,{"data-testid":"caption",style:w,children:` ${e.caption} `})]},i)}))})}))},24875:()=>{}}]);
|