@stlite/desktop 0.101.0 → 0.101.1

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/assets/{ArrowVegaLiteChart-BPRH3gBe-BAbt2P_J.js → ArrowVegaLiteChart-CatHU5ye-DE4k_KZP.js} +1 -1
  3. package/build/assets/{Audio-CoZBGqWO-DVgjOuuv.js → Audio-Y9nq0mPc-DJn2U9cz.js} +1 -1
  4. package/build/assets/{AudioInput-CP7K7uZB-DEV8Xl4i.js → AudioInput-Csthtpwn-Gk0F2DgH.js} +1 -1
  5. package/build/assets/{Balloons-Dskp5L92-ZNEwM3D8.js → Balloons-CAfRmkgd-z1flYTjg.js} +1 -1
  6. package/build/assets/{BidiComponent-DxYVG75b-CJQGNxg7.js → BidiComponent-C0W-jB8K-D7KrGlkt.js} +1 -1
  7. package/build/assets/{Button-5Ajtxbwn-BDegkHP-.js → Button-CtzCBW58-BD91cO69.js} +1 -1
  8. package/build/assets/{ButtonGroup-pGxlWp89-DmbuGG5M.js → ButtonGroup-tARGP97W-k1H0Zd3f.js} +1 -1
  9. package/build/assets/{CameraInput-vKKDhL6--Bpo-2dKV.js → CameraInput-CiV08N6Y-BKRxm_ar.js} +1 -1
  10. package/build/assets/{ChatInput-B6oFIFHm-uQa-NGtx.js → ChatInput-CFv2o38z-D_M_04yy.js} +1 -1
  11. package/build/assets/{Checkbox-DkJE55dj-CY83TfqD.js → Checkbox-DWGcKBjY-KBwPglLJ.js} +1 -1
  12. package/build/assets/{ColorPicker-BMz1lxCB-B2MaPR-H.js → ColorPicker-DFXf_KfZ-CnAPoS0z.js} +1 -1
  13. package/build/assets/{ComponentInstance-Cemgj4S0-BMxea-Y3.js → ComponentInstance-Dlz3boBV-ElD3LiR-.js} +1 -1
  14. package/build/assets/{DataFrame-CE79SZpX-CVHFe_Oz.js → DataFrame-ZHi5iyDV-DOvZAfc9.js} +5 -5
  15. package/build/assets/{DateInput-CEc2d-u8-CCDK405-.js → DateInput-DY0AqEEz-CqSRF0qe.js} +1 -1
  16. package/build/assets/{DateTimeInput-Dxlp0suj-lPuiAonQ.js → DateTimeInput-CXPUXbNs-be2fi1AZ.js} +1 -1
  17. package/build/assets/{DeckGlJsonChart-BW5EAwx1-BE5y5UXu.js → DeckGlJsonChart-3OvaJ57f-UNRd4a-y.js} +1 -1
  18. package/build/assets/{DownloadButton-DV8eX00c-kOA1BAvU.js → DownloadButton-DmVVeFJl-Do7BZpDb.js} +1 -1
  19. package/build/assets/{ErrorOutline.esm-iPLqAm6s-BL6R0-E8.js → ErrorOutline.esm-YgtldkCQ-CemIM7Sw.js} +1 -1
  20. package/build/assets/{Feedback-MVQzrJry-Dd1sPXaV.js → Feedback-BcHw2pQG-CaKtB97h.js} +1 -1
  21. package/build/assets/{FileDownload.esm-8YapEt7k-NoDtFt6j.js → FileDownload.esm-DA6EBJWo-CxqNcH-o.js} +1 -1
  22. package/build/assets/{FileUploader-Bq3BegdV-B3r5TUWB.js → FileUploader-Dpa-JOXx-BcyQjtX1.js} +1 -1
  23. package/build/assets/{FormSubmitContent-DD_l2XQL-BimOkDO8.js → FormSubmitContent-BjnJlt70-CMef_LQq.js} +1 -1
  24. package/build/assets/{GraphVizChart-j4WovvTA-C0wWJ_pD.js → GraphVizChart-DvlJXY81-DgyqPG63.js} +1 -1
  25. package/build/assets/{Html-D79N9lS4-DAD924qV.js → Html-B0_sFMha-C_dmalFu.js} +1 -1
  26. package/build/assets/{IFrame-C-0ir_lX-COQZFQmq.js → IFrame-DRaylZUz-BDLId26Q.js} +1 -1
  27. package/build/assets/{ImageList-DITlvS6g-BFNsGTg4.js → ImageList-C_I_gGvM-DLKWaXo_.js} +1 -1
  28. package/build/assets/{InputInstructions-nOmuO-zQ-DLhhHeOF.js → InputInstructions-BQBBgzXB-CiqDziMj.js} +1 -1
  29. package/build/assets/{Json-dkGVRbLV-BZzUtwOp.js → Json-C6_T-DWT-DkBsT-1G.js} +1 -1
  30. package/build/assets/{LinkButton-CxeesGpD-XutrRy0n.js → LinkButton-6uqUWhGF-D7wFQ281.js} +1 -1
  31. package/build/assets/{MenuButton-UcWUeA29-CQZ7nqVP.js → MenuButton-Bmt95URR-DWfL9ITb.js} +1 -1
  32. package/build/assets/{Metric-E6w6g5y9-Dk-6h2Zo.js → Metric-SKreeL3S-D11O16iU.js} +1 -1
  33. package/build/assets/{Multiselect-C_J-6rRf-BBLmmdLo.js → Multiselect-C7QmmmLa-DswxpHA8.js} +1 -1
  34. package/build/assets/{NumberInput-CmmPAj3n-BvWR0X5L.js → NumberInput-zpxbqqaI-BemEeZnC.js} +1 -1
  35. package/build/assets/{PageLink-B_F10WTa-BFWV94JC.js → PageLink-CS25U8sD-DuDcJ3as.js} +1 -1
  36. package/build/assets/{Particles-Dg4BbwYl-DxeaHInY.js → Particles-CvcHVa3B-D8gsFknc.js} +1 -1
  37. package/build/assets/{PlotlyChart-D4XY8twK-DVP8NFHB.js → PlotlyChart-CvayS3p7-Chny3tV_.js} +1 -1
  38. package/build/assets/{Progress-B1iI3faW-BbsFPR94.js → Progress-DGYWLpfg-CRiA40l6.js} +1 -1
  39. package/build/assets/{ProgressBar-Dxdjhh5v-CTb2XLYl.js → ProgressBar-DhIwITyC-B3HjvnkD.js} +1 -1
  40. package/build/assets/{Radio-BrYX5pm0-CF7BRVxx.js → Radio-DpOh-J7A-CQZUGZrw.js} +1 -1
  41. package/build/assets/{Selectbox-sP6HTvqf-DlF5ZFtf.js → Selectbox-3CDAXdnY-CsatfdqB.js} +1 -1
  42. package/build/assets/{Slider-D98WJ7GD-BEhH17Zd.js → Slider-DMZ19nRR-D59HIM6O.js} +1 -1
  43. package/build/assets/{Snow-BEe0B8y4-DD2qBOW1.js → Snow-5YC5Tskh-CYK5UTTk.js} +1 -1
  44. package/build/assets/{Spinner-iDUBO9CD-D_zDEDrL.js → Spinner-B3_-SaXN-McIq5xMY.js} +1 -1
  45. package/build/assets/{StreamlitSyntaxHighlighter-B0XLn_aG-C0Kyhnly.js → StreamlitSyntaxHighlighter-BQaPTFQq-D7Uj2Adi.js} +1 -1
  46. package/build/assets/{Table-BN3amuUX-_h5zNOPx.js → Table-Bc9x-fDk-DqKxodLp.js} +1 -1
  47. package/build/assets/{TableChart.esm-BEJJfW1D-DZXow7YN.js → TableChart.esm-DqSB-klz-DFWt0snW.js} +1 -1
  48. package/build/assets/{TextArea-BEB_9fLu-CW8pYEVM.js → TextArea-B1xQzjI6-B02nvgg-.js} +1 -1
  49. package/build/assets/{TextInput-CnKuZu4D-BpWqERh9.js → TextInput-D1xd0P97-BixpGDSG.js} +1 -1
  50. package/build/assets/{TimeInput-p5WNkWhN-5G1YCgeW.js → TimeInput-DuMfskY4-BipgeoUn.js} +1 -1
  51. package/build/assets/{Toast-CamIWrFG-D9p31VL8.js → Toast-CJKq1jpo-CCJnP6c1.js} +1 -1
  52. package/build/assets/{Video-QwWFy5xP-BpsExZGv.js → Video-B1N4EHQq-nnkWrBjK.js} +1 -1
  53. package/build/assets/{WidgetLabel-UxhCOQGD-Outa0e9S.js → WidgetLabel-CQfHGtry-H2bBW1_F.js} +1 -1
  54. package/build/assets/{WidgetLabelHelpIcon-B9x-Yn7N-DaZaIL2I.js → WidgetLabelHelpIcon-C6IRqJ_I-CThDB-RY.js} +1 -1
  55. package/build/assets/{WidgetLabelHelpIconInline-DpAdsUdv-BJmzytr_.js → WidgetLabelHelpIconInline-BTmzKeRa-Duj2btUF.js} +1 -1
  56. package/build/assets/{_baseAssignValue-5yAp7ssZ-B_y2bL7u.js → _baseAssignValue-CvLdsscI-CrqCsrMj.js} +1 -1
  57. package/build/assets/{base-input-BruRHirU-Dc9fKcQ_.js → base-input-Drzzu2Q6-ChupVbXS.js} +1 -1
  58. package/build/assets/{checkbox-SGVQt8CZ-CUyChNRB.js → checkbox-BlFkpHIT--ezfhS9t.js} +1 -1
  59. package/build/assets/{constants-BAtobv15-hfdyP7sx.js → constants-yZa2TGaZ-C7XGmSjZ.js} +1 -1
  60. package/build/assets/{createDownloadLinkElement-hdE2s_AI-2rp2KBS8.js → createDownloadLinkElement-CnWgptKS-DPufZYcx.js} +1 -1
  61. package/build/assets/{createSuper-DStVJdot-BgJXIEaD.js → createSuper-DfsXhqeB-CdsievJ8.js} +1 -1
  62. package/build/assets/{data-grid-overlay-editor-CpKwlh0F-Ot5bveZo.js → data-grid-overlay-editor-BylJk6rz-B2d0C4wn.js} +1 -1
  63. package/build/assets/{downloader-CZ7qD7NY-DO5yuo_B.js → downloader-CZ7qD7NY-bknF4iTS.js} +1 -1
  64. package/build/assets/{embed-BWbkDQKD-CQt2Xn8d.js → embed-C21m9f7b-B4FzBzhy.js} +1 -1
  65. package/build/assets/{es6-BxevHr5y-BFwhOTke.js → es6-BxevHr5y-CS3OejqZ.js} +1 -1
  66. package/build/assets/{formatNumber-CK08KwyC-BpCoyciY.js → formatNumber-B9NmJPl4-Bduke_Pe.js} +1 -1
  67. package/build/assets/{iconPosition-CaL2HY1u-D4CYRoRA.js → iconPosition-Cpqwt3HE-D1Z0gR4v.js} +1 -1
  68. package/build/assets/{iframeResizer.contentWindow-DwDNXvbk-Cmn9AtXP.js → iframeResizer.contentWindow-CaUMNiuy-bR3yN29o.js} +1 -1
  69. package/build/assets/{index-BWg7VeLm-DVMf1gfQ.js → index-B7jxgHEF-tvzMtMrO.js} +1 -1
  70. package/build/assets/{index-cRrBqQzO-ixGPBxWO.js → index-DINISCAW-ClgNywT7.js} +1 -1
  71. package/build/assets/{index-B14K3STS-DjuURwqx.js → index-DZZFubxH-pza9foUu.js} +1 -1
  72. package/build/assets/{index-CC2oI2tl-B1Janb2E.js → index-Dk9oWC2N-Cm5J-5pS.js} +1 -1
  73. package/build/assets/{index-DtJJZPfU-CoZOkYgP.js → index-DmoOfsTG-CbezIXlt.js} +1 -1
  74. package/build/assets/{index-B4fa-n2i.js → index-lR-QVdnh.js} +5 -5
  75. package/build/assets/{input-CK4OtyRn-yU_-c-Kx.js → input-CClPhvPt-ZRbRIlPm.js} +1 -1
  76. package/build/assets/{memory-C-LDMFc2-CqsiY5qN.js → memory-C-LDMFc2-grfew3Ct.js} +1 -1
  77. package/build/assets/{moment-C29_LcvN-KXJiUm6M.js → moment-C29_LcvN-DWLtgoJ3.js} +1 -1
  78. package/build/assets/{number-overlay-editor-Cdrkus19-CUUZ-u43.js → number-overlay-editor-CQ3u-ilh-C8RlzGdo.js} +1 -1
  79. package/build/assets/{pandasStylerUtils-CY1NqKTm-DwfIUg29.js → pandasStylerUtils-lPQUevWP-DCEaT5gM.js} +1 -1
  80. package/build/assets/{possibleConstructorReturn-Dp3x_67l-DW084-po.js → possibleConstructorReturn-BHiKHPYz-Ct6Qmz2B.js} +1 -1
  81. package/build/assets/{reactJsonViewCompat-BhHQdMb3-D8YsIkW1.js → reactJsonViewCompat-BZlB_0r4-DL51cX9L.js} +1 -1
  82. package/build/assets/{sandbox-DbnteG5V-DNuXtcQa.js → sandbox-DbnteG5V-HPERfLXa.js} +1 -1
  83. package/build/assets/{select-zCQ7w46r-igC065UB.js → select-DyvsciAf-taVHCqSw.js} +1 -1
  84. package/build/assets/{sprintfjs-COS3ohU3-DoDOU6OA.js → sprintfjs-pgmg3ABV-kczlFpH1.js} +1 -1
  85. package/build/assets/{stateful-menu-B1me4S43-BQ0PQHe9.js → stateful-menu-CW-YE2l8-eSvRA0_x.js} +1 -1
  86. package/build/assets/{styled-components-CQF9Arpx-CYVHnd6_.js → styled-components-BDZ1Vzrp-DV4YFEHI.js} +1 -1
  87. package/build/assets/{styled-components-k0rbnWKx-D5DoPNuy.js → styled-components-CZBaXqHz-WpjbtMki.js} +1 -1
  88. package/build/assets/{styled-components-vQd9mwpf-HK_7dsCd.js → styled-components-Cxzc3DcQ-Dx1RKHWs.js} +1 -1
  89. package/build/assets/{timepicker-EzC3uiD--BM84grrq.js → timepicker-Bp949u0W-CdL6sZaL.js} +1 -1
  90. package/build/assets/{toConsumableArray-BtKF-zGi-DY9ZxPdB.js → toConsumableArray-8hd4ivs--CUX5d2F_.js} +1 -1
  91. package/build/assets/{useBasicWidgetState-BMBMOmTg-D4BUrDbU.js → useBasicWidgetState-D3zHnRUK-J72gaU7U.js} +1 -1
  92. package/build/assets/{useIntlLocale-DqYWg-Yk-vlpPga3p.js → useIntlLocale-DdLGxiZO-DJttkOFe.js} +1 -1
  93. package/build/assets/{useSelectCommon-CTMZGTGc-Ce0_Hd3P.js → useSelectCommon-CZP9dNty-DYUDYQZN.js} +1 -1
  94. package/build/assets/{useTextInputAutoExpand-CnKMosrs-B4eb5Sf7.js → useTextInputAutoExpand-D9pA1iXq-B_21ViwV.js} +1 -1
  95. package/build/assets/{useUpdateUiValue-B9f-9GF1-ClPAYOW9.js → useUpdateUiValue-CsBMIrnj-BopSFNwe.js} +1 -1
  96. package/build/assets/{useWaveformController-vz6xEIpB-By40P5gh.js → useWaveformController-rxqEhP00-CEw8q0Aj.js} +1 -1
  97. package/build/assets/{utils-C0gaaqVX-vUUpSioz.js → utils-CotIDfd1-2L45u02v.js} +1 -1
  98. package/build/assets/{withCalculatedWidth-B-DDl_d6-BCYIlY-Q.js → withCalculatedWidth-DwrWHMUR-B2yMBY1O.js} +1 -1
  99. package/build/assets/{withFullScreenWrapper-CuXVCIWH-BixTXCsJ.js → withFullScreenWrapper-tGGSjEWy-BaPaU-BF.js} +1 -1
  100. package/build/assets/worker-BOAT2Vs2-B55LI3Y4.js +1020 -0
  101. package/build/electron/worker.js +9 -9
  102. package/build/index.html +1 -1
  103. package/package.json +3 -3
  104. package/wheels/stlite_lib-0.1.0-py3-none-any.whl +0 -0
  105. package/wheels/streamlit-1.57.0-cp313-none-any.whl +0 -0
  106. package/build/assets/worker-au3nYZmM-CULfdmAh.js +0 -930
@@ -0,0 +1,1020 @@
1
+ function de(o) {
2
+ return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
3
+ }
4
+ var O, q;
5
+ function ue() {
6
+ if (q) return O;
7
+ q = 1;
8
+ function o(n) {
9
+ if (typeof n != "string")
10
+ throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
11
+ }
12
+ function r(n, e) {
13
+ for (var t = "", l = 0, a = -1, u = 0, i, h = 0; h <= n.length; ++h) {
14
+ if (h < n.length)
15
+ i = n.charCodeAt(h);
16
+ else {
17
+ if (i === 47)
18
+ break;
19
+ i = 47;
20
+ }
21
+ if (i === 47) {
22
+ if (!(a === h - 1 || u === 1)) if (a !== h - 1 && u === 2) {
23
+ if (t.length < 2 || l !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) {
24
+ if (t.length > 2) {
25
+ var y = t.lastIndexOf("/");
26
+ if (y !== t.length - 1) {
27
+ y === -1 ? (t = "", l = 0) : (t = t.slice(0, y), l = t.length - 1 - t.lastIndexOf("/")), a = h, u = 0;
28
+ continue;
29
+ }
30
+ } else if (t.length === 2 || t.length === 1) {
31
+ t = "", l = 0, a = h, u = 0;
32
+ continue;
33
+ }
34
+ }
35
+ e && (t.length > 0 ? t += "/.." : t = "..", l = 2);
36
+ } else
37
+ t.length > 0 ? t += "/" + n.slice(a + 1, h) : t = n.slice(a + 1, h), l = h - a - 1;
38
+ a = h, u = 0;
39
+ } else i === 46 && u !== -1 ? ++u : u = -1;
40
+ }
41
+ return t;
42
+ }
43
+ function s(n, e) {
44
+ var t = e.dir || e.root, l = e.base || (e.name || "") + (e.ext || "");
45
+ return t ? t === e.root ? t + l : t + n + l : l;
46
+ }
47
+ var c = {
48
+ // path.resolve([from ...], to)
49
+ resolve: function() {
50
+ for (var e = "", t = !1, l, a = arguments.length - 1; a >= -1 && !t; a--) {
51
+ var u;
52
+ a >= 0 ? u = arguments[a] : (l === void 0 && (l = process.cwd()), u = l), o(u), u.length !== 0 && (e = u + "/" + e, t = u.charCodeAt(0) === 47);
53
+ }
54
+ return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
55
+ },
56
+ normalize: function(e) {
57
+ if (o(e), e.length === 0) return ".";
58
+ var t = e.charCodeAt(0) === 47, l = e.charCodeAt(e.length - 1) === 47;
59
+ return e = r(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && l && (e += "/"), t ? "/" + e : e;
60
+ },
61
+ isAbsolute: function(e) {
62
+ return o(e), e.length > 0 && e.charCodeAt(0) === 47;
63
+ },
64
+ join: function() {
65
+ if (arguments.length === 0)
66
+ return ".";
67
+ for (var e, t = 0; t < arguments.length; ++t) {
68
+ var l = arguments[t];
69
+ o(l), l.length > 0 && (e === void 0 ? e = l : e += "/" + l);
70
+ }
71
+ return e === void 0 ? "." : c.normalize(e);
72
+ },
73
+ relative: function(e, t) {
74
+ if (o(e), o(t), e === t || (e = c.resolve(e), t = c.resolve(t), e === t)) return "";
75
+ for (var l = 1; l < e.length && e.charCodeAt(l) === 47; ++l)
76
+ ;
77
+ for (var a = e.length, u = a - l, i = 1; i < t.length && t.charCodeAt(i) === 47; ++i)
78
+ ;
79
+ for (var h = t.length, y = h - i, b = u < y ? u : y, d = -1, p = 0; p <= b; ++p) {
80
+ if (p === b) {
81
+ if (y > b) {
82
+ if (t.charCodeAt(i + p) === 47)
83
+ return t.slice(i + p + 1);
84
+ if (p === 0)
85
+ return t.slice(i + p);
86
+ } else u > b && (e.charCodeAt(l + p) === 47 ? d = p : p === 0 && (d = 0));
87
+ break;
88
+ }
89
+ var v = e.charCodeAt(l + p), C = t.charCodeAt(i + p);
90
+ if (v !== C)
91
+ break;
92
+ v === 47 && (d = p);
93
+ }
94
+ var R = "";
95
+ for (p = l + d + 1; p <= a; ++p)
96
+ (p === a || e.charCodeAt(p) === 47) && (R.length === 0 ? R += ".." : R += "/..");
97
+ return R.length > 0 ? R + t.slice(i + d) : (i += d, t.charCodeAt(i) === 47 && ++i, t.slice(i));
98
+ },
99
+ _makeLong: function(e) {
100
+ return e;
101
+ },
102
+ dirname: function(e) {
103
+ if (o(e), e.length === 0) return ".";
104
+ for (var t = e.charCodeAt(0), l = t === 47, a = -1, u = !0, i = e.length - 1; i >= 1; --i)
105
+ if (t = e.charCodeAt(i), t === 47) {
106
+ if (!u) {
107
+ a = i;
108
+ break;
109
+ }
110
+ } else
111
+ u = !1;
112
+ return a === -1 ? l ? "/" : "." : l && a === 1 ? "//" : e.slice(0, a);
113
+ },
114
+ basename: function(e, t) {
115
+ if (t !== void 0 && typeof t != "string") throw new TypeError('"ext" argument must be a string');
116
+ o(e);
117
+ var l = 0, a = -1, u = !0, i;
118
+ if (t !== void 0 && t.length > 0 && t.length <= e.length) {
119
+ if (t.length === e.length && t === e) return "";
120
+ var h = t.length - 1, y = -1;
121
+ for (i = e.length - 1; i >= 0; --i) {
122
+ var b = e.charCodeAt(i);
123
+ if (b === 47) {
124
+ if (!u) {
125
+ l = i + 1;
126
+ break;
127
+ }
128
+ } else
129
+ y === -1 && (u = !1, y = i + 1), h >= 0 && (b === t.charCodeAt(h) ? --h === -1 && (a = i) : (h = -1, a = y));
130
+ }
131
+ return l === a ? a = y : a === -1 && (a = e.length), e.slice(l, a);
132
+ } else {
133
+ for (i = e.length - 1; i >= 0; --i)
134
+ if (e.charCodeAt(i) === 47) {
135
+ if (!u) {
136
+ l = i + 1;
137
+ break;
138
+ }
139
+ } else a === -1 && (u = !1, a = i + 1);
140
+ return a === -1 ? "" : e.slice(l, a);
141
+ }
142
+ },
143
+ extname: function(e) {
144
+ o(e);
145
+ for (var t = -1, l = 0, a = -1, u = !0, i = 0, h = e.length - 1; h >= 0; --h) {
146
+ var y = e.charCodeAt(h);
147
+ if (y === 47) {
148
+ if (!u) {
149
+ l = h + 1;
150
+ break;
151
+ }
152
+ continue;
153
+ }
154
+ a === -1 && (u = !1, a = h + 1), y === 46 ? t === -1 ? t = h : i !== 1 && (i = 1) : t !== -1 && (i = -1);
155
+ }
156
+ return t === -1 || a === -1 || // We saw a non-dot character immediately before the dot
157
+ i === 0 || // The (right-most) trimmed path component is exactly '..'
158
+ i === 1 && t === a - 1 && t === l + 1 ? "" : e.slice(t, a);
159
+ },
160
+ format: function(e) {
161
+ if (e === null || typeof e != "object")
162
+ throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
163
+ return s("/", e);
164
+ },
165
+ parse: function(e) {
166
+ o(e);
167
+ var t = { root: "", dir: "", base: "", ext: "", name: "" };
168
+ if (e.length === 0) return t;
169
+ var l = e.charCodeAt(0), a = l === 47, u;
170
+ a ? (t.root = "/", u = 1) : u = 0;
171
+ for (var i = -1, h = 0, y = -1, b = !0, d = e.length - 1, p = 0; d >= u; --d) {
172
+ if (l = e.charCodeAt(d), l === 47) {
173
+ if (!b) {
174
+ h = d + 1;
175
+ break;
176
+ }
177
+ continue;
178
+ }
179
+ y === -1 && (b = !1, y = d + 1), l === 46 ? i === -1 ? i = d : p !== 1 && (p = 1) : i !== -1 && (p = -1);
180
+ }
181
+ return i === -1 || y === -1 || // We saw a non-dot character immediately before the dot
182
+ p === 0 || // The (right-most) trimmed path component is exactly '..'
183
+ p === 1 && i === y - 1 && i === h + 1 ? y !== -1 && (h === 0 && a ? t.base = t.name = e.slice(1, y) : t.base = t.name = e.slice(h, y)) : (h === 0 && a ? (t.name = e.slice(1, i), t.base = e.slice(1, y)) : (t.name = e.slice(h, i), t.base = e.slice(h, y)), t.ext = e.slice(i, y)), h > 0 ? t.dir = e.slice(0, h - 1) : a && (t.dir = "/"), t;
184
+ },
185
+ sep: "/",
186
+ delimiter: ":",
187
+ win32: null,
188
+ posix: null
189
+ };
190
+ return c.posix = c, O = c, O;
191
+ }
192
+ var pe = ue(), I = /* @__PURE__ */ de(pe);
193
+ const K = "/home/pyodide", Q = (o) => `${K}/${o}`, F = (o, r) => o == null ? I.resolve(K, r) : I.resolve(Q(o), r);
194
+ function V(o, r) {
195
+ const s = I.normalize(r), n = I.dirname(s).split(/(?=\/)/);
196
+ let e = "";
197
+ for (const t of n) {
198
+ e += t;
199
+ const l = o.FS.analyzePath(e);
200
+ if (l.exists && l.object) {
201
+ if (!o.FS.isDir(l.object.mode))
202
+ throw new Error(`"${e}" already exists and is not a directory.`);
203
+ continue;
204
+ }
205
+ try {
206
+ o.FS.mkdir(e);
207
+ } catch (a) {
208
+ throw console.error(`Failed to create a directory "${e}"`), a;
209
+ }
210
+ }
211
+ }
212
+ function Y(o, r, s, c) {
213
+ V(o, r), o.FS.writeFile(r, s, c);
214
+ }
215
+ function fe(o, r, s) {
216
+ V(o, s), o.FS.rename(r, s);
217
+ }
218
+ const ge = "[", me = "(<=>!~", he = ";", ye = "@", be = new RegExp(`[${ge + me + he + ye}]`);
219
+ function _e(o) {
220
+ return o.split(be)[0].trim();
221
+ }
222
+ function W(o) {
223
+ return o.forEach((s) => {
224
+ let c;
225
+ try {
226
+ c = new URL(s);
227
+ } catch {
228
+ return;
229
+ }
230
+ if (c.protocol === "emfs:" || c.protocol === "file:")
231
+ throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${s})`);
232
+ }), o.filter((s) => _e(s) === "streamlit" ? (console.warn(`Streamlit is specified in the requirements ("${s}"), but it will be ignored. A built-in version of Streamlit will be used.`), !1) : !0);
233
+ }
234
+ async function we(o) {
235
+ const r = typeof process < "u" && process.versions?.node;
236
+ let s;
237
+ r ? s = (await import(
238
+ /* webpackIgnore: true */
239
+ "./__vite-browser-external-CPvbk0mb.js"
240
+ )).sep : s = "/";
241
+ const c = o.slice(0, o.lastIndexOf(s) + 1);
242
+ if (o.endsWith(".mjs")) {
243
+ if (r) {
244
+ const n = await import(
245
+ /* webpackIgnore: true */
246
+ "./__vite-browser-external-CPvbk0mb.js"
247
+ ), e = await import(
248
+ /* webpackIgnore: true */
249
+ "./__vite-browser-external-CPvbk0mb.js"
250
+ );
251
+ !o.includes("://") && n.isAbsolute(o) && (o = e.pathToFileURL(o).href);
252
+ }
253
+ return {
254
+ scriptURL: o,
255
+ pyodideIndexURL: c,
256
+ isESModule: !0
257
+ };
258
+ } else
259
+ return {
260
+ scriptURL: o,
261
+ pyodideIndexURL: c,
262
+ isESModule: !1
263
+ };
264
+ }
265
+ async function ve(o, r) {
266
+ const { scriptURL: s, pyodideIndexURL: c, isESModule: n } = await we(o);
267
+ let e;
268
+ return n ? e = (await import(
269
+ /* webpackIgnore: true */
270
+ /* @vite-ignore */
271
+ s
272
+ )).loadPyodide : (importScripts(s), e = self.loadPyodide), e({ ...r, indexURL: c });
273
+ }
274
+ function ke(o) {
275
+ o.runPython(`
276
+ import micropip
277
+ micropip.add_mock_package(
278
+ "pyarrow", "0.0.1",
279
+ modules={
280
+ "pyarrow": """
281
+ __version__ = '0.0.1' # TODO: Update when releasing
282
+
283
+
284
+ class Table:
285
+ @classmethod
286
+ def from_pandas(*args, **kwargs):
287
+ raise NotImplementedError("stlite is not supporting this method.")
288
+
289
+
290
+ class Array:
291
+ def __init__(self, *args, **kwargs):
292
+ raise NotImplementedError("stlite is not supporting PyArrow.Array")
293
+
294
+
295
+ class ChunkedArray:
296
+ def __init__(self, *args, **kwargs):
297
+ raise NotImplementedError("stlite is not supporting PyArrow.ChunkedArray")
298
+ """
299
+ }
300
+ )
301
+ `);
302
+ }
303
+ function Se(o, r, s) {
304
+ const c = o.pyimport("pyodide"), n = (i) => c.code.find_imports(i).toJs(), e = s.map((i) => n(i)), a = Array.from(new Set(e.flat())).filter((i) => !o.runPython(`__import__('importlib').util.find_spec('${i}')`)).map((i) => o._api._import_name_to_package_name.get(i)).filter((i) => i);
305
+ if (a.length === 0)
306
+ return Promise.resolve();
307
+ const u = o.loadPackage(a);
308
+ return r(a, u), u.then();
309
+ }
310
+ function Z(o, r, s) {
311
+ const c = Se(o, r, s);
312
+ o.runPython(`
313
+ def __set_module_auto_load_promise__(promise):
314
+ from streamlit.runtime.scriptrunner import script_runner
315
+ script_runner.moduleAutoLoadPromise = promise
316
+
317
+ __set_module_auto_load_promise__`)(c);
318
+ }
319
+ async function Pe(o, r, s) {
320
+ const { line: c, column: n } = s, e = o.Script(r);
321
+ if (c > e._code_lines.length)
322
+ return [];
323
+ const t = e.complete.callKwargs({
324
+ line: c,
325
+ column: n,
326
+ fuzzy: !1
327
+ }), l = [];
328
+ for (const a of t.toJs())
329
+ l.push({
330
+ name: a.name,
331
+ type: a.$type,
332
+ // PyProxy.type is overridden in Pyodide. We need to access it this way. Ref: https://github.com/pyodide/pyodide/issues/4032
333
+ docstring: a.docstring.callKwargs({ raw: !0 }),
334
+ complete: a.complete
335
+ }), a.destroy();
336
+ return l;
337
+ }
338
+ const ee = { version: "3.0", spec_version: "2.3" }, te = "1.1";
339
+ class Ae {
340
+ items = [];
341
+ waiters = [];
342
+ enqueue(r) {
343
+ const s = this.waiters.shift();
344
+ s ? s(r) : this.items.push(r);
345
+ }
346
+ dequeue() {
347
+ const r = this.items.shift();
348
+ return r !== void 0 ? Promise.resolve(r) : new Promise((s) => {
349
+ this.waiters.push(s);
350
+ });
351
+ }
352
+ }
353
+ function Ce(o) {
354
+ const r = new URL(o.path, "http://stlite.local"), s = Object.entries(o.headers).map(([c, n]) => [
355
+ new TextEncoder().encode(c.toLowerCase()),
356
+ new TextEncoder().encode(n)
357
+ ]);
358
+ return {
359
+ type: "http",
360
+ asgi: ee,
361
+ http_version: te,
362
+ method: o.method.toUpperCase(),
363
+ scheme: "http",
364
+ path: r.pathname,
365
+ raw_path: new TextEncoder().encode(r.pathname),
366
+ query_string: new TextEncoder().encode(r.search.replace(/^\?/, "")),
367
+ root_path: "",
368
+ headers: s,
369
+ client: ["stlite", 0],
370
+ server: ["stlite", 80]
371
+ };
372
+ }
373
+ function Re(o) {
374
+ return typeof o == "string" ? new TextEncoder().encode(o) : new Uint8Array(o);
375
+ }
376
+ function oe(o) {
377
+ return o && typeof o.toJs == "function" ? o.toJs({ dict_converter: Object.fromEntries }) : o;
378
+ }
379
+ async function $(o, r) {
380
+ const s = Ce(r), c = Re(r.body);
381
+ let n = !1;
382
+ const e = async () => n ? { type: "http.disconnect" } : (n = !0, {
383
+ type: "http.request",
384
+ body: c,
385
+ more_body: !1
386
+ });
387
+ let t = 0;
388
+ const l = new Headers(), a = [];
389
+ await o(s, e, async (b) => {
390
+ const d = oe(b);
391
+ if (d.type === "http.response.start") {
392
+ t = d.status ?? 0;
393
+ const p = d.headers ?? [];
394
+ for (const [v, C] of p)
395
+ l.append(N(v), N(C));
396
+ } else if (d.type === "http.response.body") {
397
+ const p = d.body;
398
+ p && p.byteLength > 0 && a.push(p);
399
+ }
400
+ });
401
+ const i = a.reduce((b, d) => b + d.byteLength, 0), h = new Uint8Array(i);
402
+ let y = 0;
403
+ for (const b of a)
404
+ h.set(b, y), y += b.byteLength;
405
+ return { statusCode: t, headers: l, body: h };
406
+ }
407
+ function Ee(o) {
408
+ const r = new URL(o.path, "ws://stlite.local"), s = Object.entries(o.headers ?? {}).map(([c, n]) => [
409
+ new TextEncoder().encode(c.toLowerCase()),
410
+ new TextEncoder().encode(n)
411
+ ]);
412
+ return {
413
+ type: "websocket",
414
+ asgi: ee,
415
+ http_version: te,
416
+ scheme: "ws",
417
+ path: r.pathname,
418
+ raw_path: new TextEncoder().encode(r.pathname),
419
+ query_string: new TextEncoder().encode(r.search.replace(/^\?/, "")),
420
+ root_path: "",
421
+ headers: s,
422
+ client: ["stlite", 0],
423
+ server: ["stlite", 80],
424
+ subprotocols: o.subprotocols ?? []
425
+ };
426
+ }
427
+ class Le {
428
+ asgiApp;
429
+ scope;
430
+ onServerSend;
431
+ receiveQueue = new Ae();
432
+ acceptedResolve;
433
+ acceptedReject;
434
+ acceptedPromise;
435
+ appTask = null;
436
+ closed = !1;
437
+ constructor(r, s, c) {
438
+ this.asgiApp = r, this.scope = s, this.onServerSend = c, this.acceptedPromise = new Promise((n, e) => {
439
+ this.acceptedResolve = n, this.acceptedReject = e;
440
+ });
441
+ }
442
+ start() {
443
+ this.receiveQueue.enqueue({ type: "websocket.connect" });
444
+ const r = () => this.receiveQueue.dequeue(), s = async (n) => {
445
+ const e = oe(n);
446
+ if (e.type === "websocket.accept") {
447
+ this.acceptedResolve(e.subprotocol ?? null);
448
+ return;
449
+ }
450
+ e.type === "websocket.close" && !this.closed && this.acceptedReject(new Error(`WebSocket closed before accept (code=${e.code ?? "?"})`)), this.onServerSend(e);
451
+ }, c = this.asgiApp(this.scope, r, s);
452
+ return this.appTask = Promise.resolve(c), this.appTask.catch((n) => {
453
+ this.acceptedReject(n);
454
+ }), this.acceptedPromise;
455
+ }
456
+ postClientMessage(r) {
457
+ if (this.closed)
458
+ return;
459
+ const s = typeof r == "string" ? { type: "websocket.receive", text: r } : { type: "websocket.receive", bytes: r };
460
+ this.receiveQueue.enqueue(s);
461
+ }
462
+ async close(r = 1e3) {
463
+ if (!this.closed && (this.closed = !0, this.receiveQueue.enqueue({ type: "websocket.disconnect", code: r }), this.appTask))
464
+ try {
465
+ await this.appTask;
466
+ } catch {
467
+ }
468
+ }
469
+ }
470
+ function N(o) {
471
+ return new TextDecoder("utf-8").decode(o);
472
+ }
473
+ const x = "_streamlit_xsrf", B = "X-XSRFtoken", Fe = "/_stcore/upload_file";
474
+ function re(o, r) {
475
+ const s = r.toLowerCase();
476
+ return Object.entries(o).find(([n]) => n.toLowerCase() === s)?.[1];
477
+ }
478
+ function Te(o, r) {
479
+ return re(o, r) !== void 0;
480
+ }
481
+ function Ie(o) {
482
+ return o.split(/,(?=\s*[^;,]+=)/).map((r) => r.trim());
483
+ }
484
+ function Me(o) {
485
+ const s = o.getSetCookie?.();
486
+ if (s)
487
+ return s;
488
+ const c = o.get("set-cookie");
489
+ return c ? Ie(c) : [];
490
+ }
491
+ function He(o) {
492
+ const r = o.split(";", 1)[0] ?? "", s = r.indexOf("=");
493
+ return s <= 0 ? null : [
494
+ r.slice(0, s).trim(),
495
+ r.slice(s + 1).trim()
496
+ ];
497
+ }
498
+ function D(o) {
499
+ return o.method !== "PUT" && o.method !== "DELETE" ? !1 : new URL(o.path, "http://stlite.local").pathname.startsWith(Fe);
500
+ }
501
+ class Oe {
502
+ cookies = /* @__PURE__ */ new Map();
503
+ clear() {
504
+ this.cookies.clear();
505
+ }
506
+ storeFromResponse(r) {
507
+ for (const s of Me(r)) {
508
+ const c = He(s);
509
+ if (!c)
510
+ continue;
511
+ const [n, e] = c;
512
+ if (n === x && e === "") {
513
+ this.cookies.delete(n);
514
+ continue;
515
+ }
516
+ this.cookies.set(n, e);
517
+ }
518
+ }
519
+ getCookieHeader() {
520
+ return Array.from(this.cookies).map(([r, s]) => `${r}=${s}`).join("; ");
521
+ }
522
+ needsXsrfWarmup(r) {
523
+ return D(r) && !this.cookies.get(x);
524
+ }
525
+ applyToRequest(r) {
526
+ const s = this.getCookieHeader(), c = this.cookies.get(x);
527
+ if (!s && !(c && D(r)))
528
+ return r;
529
+ const n = { ...r.headers };
530
+ if (s) {
531
+ const e = re(n, "cookie");
532
+ for (const t of Object.keys(n))
533
+ t.toLowerCase() === "cookie" && delete n[t];
534
+ n.Cookie = e ? `${e}; ${s}` : s;
535
+ }
536
+ return c && D(r) && !Te(n, B) && (n[B] = c), {
537
+ ...r,
538
+ headers: n
539
+ };
540
+ }
541
+ }
542
+ let j = null, z = Promise.resolve(), U = !1;
543
+ async function xe(o, r, s, c, n) {
544
+ const { files: e, archives: t, requirements: l, prebuiltPackageNames: a, wheels: u, installs: i, pyodideUrl: h = o, streamlitConfig: y, idbfsMountpoints: b, nodefsMountpoints: d, moduleAutoLoad: p, env: v, languageServer: C } = s, R = W(l);
545
+ j ? (n("Pyodide is already loaded."), console.debug("Pyodide is already loaded.")) : (n("Loading Pyodide."), console.debug("Loading Pyodide."), j = ve(h, {
546
+ stdout: console.log,
547
+ stderr: console.error
548
+ }), console.debug("Loaded Pyodide"));
549
+ const w = (
550
+ // XXX: `{ FS: any }` is a temporary workaround to fix the type error.
551
+ await j
552
+ );
553
+ if (v) {
554
+ console.debug("Setting environment variables", v);
555
+ const m = w.pyimport("os");
556
+ m.environ.update(w.toPy(v)), console.debug("Set environment variables", m.environ);
557
+ }
558
+ let L = !1;
559
+ b && (L = !0, b.forEach((m) => {
560
+ w.FS.mkdir(m), w.FS.mount(w.FS.filesystems.IDBFS, {}, m);
561
+ }), await new Promise((m, k) => {
562
+ w.FS.syncfs(!0, (A) => {
563
+ A ? k(A) : m();
564
+ });
565
+ })), d && Object.entries(d).forEach(([m, k]) => {
566
+ w.FS.mkdir(m), w.FS.mount(w.FS.filesystems.NODEFS, { root: k }, m);
567
+ }), n("Mounting files.");
568
+ const T = [];
569
+ await Promise.all(Object.keys(e).map(async (m) => {
570
+ const k = e[m];
571
+ m = F(r, m);
572
+ let A;
573
+ "url" in k ? (console.debug(`Fetch a file from ${k.url}`), A = await fetch(k.url).then((E) => E.arrayBuffer()).then((E) => new Uint8Array(E))) : A = k.data, console.debug(`Write a file "${m}"`), Y(w, m, A, e.opts), m.endsWith(".py") && T.push(m);
574
+ })), n("Unpacking archives."), await Promise.all(t.map(async (m) => {
575
+ let k;
576
+ "url" in m ? (console.debug(`Fetch an archive from ${m.url}`), k = await fetch(m.url).then((ce) => ce.arrayBuffer())) : k = m.buffer;
577
+ const { format: A, options: E } = m;
578
+ console.debug("Unpack an archive", { format: A, options: E }), w.unpackArchive(k, A, E);
579
+ })), await w.loadPackage("micropip");
580
+ const S = w.pyimport("micropip");
581
+ n("Mocking some packages."), console.debug("Mock pyarrow"), ke(w), console.debug("Mocked pyarrow"), n("Installing packages."), console.debug("Installing the prebuilt packages:", a), await w.loadPackage(a), console.debug("Installed the prebuilt packages");
582
+ const M = async () => {
583
+ console.debug("Installing the packages:", {
584
+ requirements: R,
585
+ systemPackagesInstalled: U
586
+ });
587
+ const m = [];
588
+ U || (console.debug("System packages will be installed"), u && (m.push("protobuf>=7.34.1,<8"), m.push(u.streamlit), m.push(u.stliteLib)), C && m.push("jedi"));
589
+ const k = [...m, ...R];
590
+ console.debug("Installing the packages:", k), await S.install.callKwargs(k, { keep_going: !0 }), m.length > 0 && (console.debug("Installed the system packages"), U = !0), console.debug("Installed the packages");
591
+ }, g = z.then(() => M());
592
+ if (z = g.catch((m) => {
593
+ console.error("Package installation failed:", m);
594
+ }), await g, i && (console.debug("Installing the additional requirements"), await Promise.all(i.map(({ requirements: m, options: k }) => {
595
+ const A = W(m);
596
+ return console.debug("Installing the requirements:", A), S.install.callKwargs(A, k ?? {});
597
+ }))), p) {
598
+ const m = T.map((k) => w.FS.readFile(k, { encoding: "utf8" }));
599
+ Z(w, c, m);
600
+ }
601
+ await w.runPythonAsync(`
602
+ import importlib
603
+ importlib.invalidate_caches()
604
+ `), n("Loading streamlit package."), console.debug("Loading the Streamlit package"), await w.runPythonAsync(`
605
+ import streamlit.runtime
606
+ `), console.debug("Loaded the Streamlit package"), n("Setting up the loggers."), console.debug("Setting the loggers"), await w.runPythonAsync(`
607
+ import logging
608
+ import streamlit.logger
609
+
610
+ streamlit.logger.get_logger = logging.getLogger
611
+ streamlit.logger.setup_formatter = None
612
+ streamlit.logger.update_formatter = lambda *a, **k: None
613
+ streamlit.logger.set_log_level = lambda *a, **k: None
614
+
615
+ for name in streamlit.logger._loggers.keys():
616
+ if name == "root":
617
+ name = "streamlit"
618
+ logger = logging.getLogger(name)
619
+ logger.propagate = True
620
+ logger.handlers.clear()
621
+ logger.setLevel(logging.NOTSET)
622
+
623
+ streamlit.logger._loggers = {}
624
+ `);
625
+ const f = (m, k) => {
626
+ m >= 40 ? console.error(k) : m >= 30 ? console.warn(k) : m >= 20 ? console.info(k) : console.debug(k);
627
+ }, _ = w.runPython(`
628
+ def __setup_loggers__(streamlit_level, streamlit_message_format, callback):
629
+ class JsHandler(logging.Handler):
630
+ def emit(self, record):
631
+ msg = self.format(record)
632
+ callback(record.levelno, msg)
633
+
634
+
635
+ root_message_format = "%(levelname)s:%(name)s:%(message)s"
636
+
637
+ root_logger = logging.getLogger()
638
+ root_logger.handlers.clear()
639
+ root_formatter = logging.Formatter(root_message_format)
640
+ root_handler = JsHandler()
641
+ root_handler.setFormatter(root_formatter)
642
+ root_logger.addHandler(root_handler)
643
+ root_logger.setLevel(logging.DEBUG)
644
+
645
+ streamlit_logger = logging.getLogger("streamlit")
646
+ streamlit_logger.propagate = False
647
+ streamlit_logger.handlers.clear()
648
+ streamlit_formatter = logging.Formatter(streamlit_message_format)
649
+ streamlit_handler = JsHandler()
650
+ streamlit_handler.setFormatter(streamlit_formatter)
651
+ streamlit_logger.addHandler(streamlit_handler)
652
+ streamlit_logger.setLevel(streamlit_level.upper())
653
+
654
+ __setup_loggers__`), P = (y?.["logger.level"] ?? "INFO").toString(), ne = y?.["logger.messageFormat"] ?? "%(asctime)s %(message)s";
655
+ if (_(P, ne, f), console.debug("Set the loggers"), n("Mocking some Streamlit functions for the browser environment."), console.debug("Mocking some Streamlit functions"), await w.runPythonAsync(`
656
+ import streamlit
657
+
658
+ def is_cacheable_msg(msg):
659
+ return False
660
+
661
+ streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg
662
+ `), console.debug("Mocked some Streamlit functions"), L) {
663
+ n("Setting up the IndexedDB filesystem synchronizer."), console.debug("Setting up the IndexedDB filesystem synchronizer");
664
+ let m = !1;
665
+ const k = () => {
666
+ console.debug("The script has finished. Syncing the filesystem."), m || (m = !0, w.FS.syncfs(!1, (E) => {
667
+ m = !1, E && console.error(E);
668
+ }));
669
+ };
670
+ (await w.runPython(`
671
+ def __setup_script_finished_callback__(callback):
672
+ from streamlit.runtime.app_session import AppSession
673
+ from streamlit.runtime.scriptrunner import ScriptRunnerEvent
674
+
675
+ def wrap_app_session_on_scriptrunner_event(original_method):
676
+ def wrapped(self, *args, **kwargs):
677
+ if "event" in kwargs:
678
+ event = kwargs["event"]
679
+ if event == ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS or event == ScriptRunnerEvent.SCRIPT_STOPPED_FOR_RERUN or event == ScriptRunnerEvent.SHUTDOWN:
680
+ callback()
681
+ return original_method(self, *args, **kwargs)
682
+ return wrapped
683
+
684
+ AppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)
685
+
686
+ __setup_script_finished_callback__`))(k), console.debug("Set up the IndexedDB filesystem synchronizer");
687
+ }
688
+ console.debug("Setting up the Streamlit configuration");
689
+ const { load_config_options: ae } = w.pyimport("stlite_lib.bootstrap"), ie = {
690
+ // gatherUsageStats is disabled as default, but can be enabled explicitly by setting it to true.
691
+ "browser.gatherUsageStats": !1,
692
+ ...y,
693
+ "runner.fastReruns": !1
694
+ // Fast reruns do not work well with the async script runner of stlite. See https://github.com/whitphx/stlite/pull/550#issuecomment-1505485865.
695
+ }, le = r != null;
696
+ ae(w.toPy(ie), le), console.debug("Set up the Streamlit configuration");
697
+ let H;
698
+ if (C) {
699
+ n("Loading auto-completion engine."), console.debug("Loading Jedi");
700
+ try {
701
+ H = await w.pyimport("jedi"), console.debug("Loaded Jedi");
702
+ } catch (m) {
703
+ console.error("Failed to load Jedi:", m), H = void 0;
704
+ }
705
+ }
706
+ return {
707
+ pyodide: w,
708
+ micropip: S,
709
+ jedi: H,
710
+ initData: s
711
+ };
712
+ }
713
+ async function J(o, r, s) {
714
+ const c = F(r, s);
715
+ console.debug("Preparing the Streamlit environment");
716
+ const { prepare: n } = o.pyimport("stlite_lib.bootstrap");
717
+ n(c, []), console.debug("Prepared the Streamlit environment"), console.debug("Booting up the Streamlit ASGI app");
718
+ const e = o.pyimport("stlite_lib.asgi_app"), t = e.create_app(c), l = await e.run_lifespan_startup(t);
719
+ e.bind_runtime_to_current_context(t);
720
+ const a = e.make_call_asgi(t, r ? Q(r) : void 0);
721
+ return console.debug("Booted up the Streamlit ASGI app"), { asgiApp: a, lifespanState: l };
722
+ }
723
+ async function De(o, r) {
724
+ const { run_lifespan_shutdown: s } = o.pyimport("stlite_lib.asgi_app");
725
+ await s(r.lifespanState), r.lifespanState.destroy();
726
+ }
727
+ function G(o, r, s, c) {
728
+ function n(b) {
729
+ r({
730
+ type: "event:loadProgress",
731
+ data: {
732
+ message: b
733
+ }
734
+ });
735
+ }
736
+ const e = (b, d) => {
737
+ const p = new MessageChannel();
738
+ r({
739
+ type: "event:moduleAutoLoad",
740
+ data: {
741
+ packagesToLoad: b
742
+ }
743
+ }, [p.port2]), d.then((v) => {
744
+ p.port1.postMessage({
745
+ type: "moduleAutoLoad:success",
746
+ data: {
747
+ loadedPackages: v
748
+ }
749
+ }), p.port1.close();
750
+ }).catch((v) => {
751
+ throw p.port1.postMessage({
752
+ type: "moduleAutoLoad:error",
753
+ error: v
754
+ }), p.port1.close(), v;
755
+ });
756
+ };
757
+ let t = null, l = null, a = null;
758
+ const u = new Oe();
759
+ async function i(b, d) {
760
+ console.debug("stlite XSRF warmup before upload", { requestPath: d });
761
+ const p = await $(b, u.applyToRequest({
762
+ method: "GET",
763
+ path: "/_stcore/health",
764
+ headers: { host: "stlite.local" },
765
+ body: ""
766
+ }));
767
+ u.storeFromResponse(p.headers), console.debug("stlite XSRF warmup response", {
768
+ requestPath: d,
769
+ statusCode: p.statusCode
770
+ });
771
+ }
772
+ async function h(b, d) {
773
+ const p = {
774
+ ...d,
775
+ path: decodeURIComponent(d.path)
776
+ };
777
+ u.needsXsrfWarmup(p) && await i(b, p.path);
778
+ const v = u.applyToRequest(p), C = await $(b, v);
779
+ return u.storeFromResponse(C.headers), C;
780
+ }
781
+ const y = async (b) => {
782
+ const d = b.data;
783
+ if (d.type === "initData") {
784
+ const g = d.data, f = {
785
+ ...s,
786
+ ...g
787
+ };
788
+ console.debug("Initial data", f), t = xe(o, c, f, e, n), t.then(({ pyodide: _ }) => (n("Booting up the Streamlit server."), l = J(_, c, f.entrypoint), l)).then(() => {
789
+ r({
790
+ type: "event:loadFinished"
791
+ });
792
+ }).catch((_) => {
793
+ console.error(_), r({
794
+ type: "event:loadError",
795
+ data: {
796
+ error: _
797
+ }
798
+ });
799
+ });
800
+ return;
801
+ }
802
+ if (!t)
803
+ throw new Error("Pyodide initialization has not been started yet.");
804
+ if (!l)
805
+ throw new Error("Streamlit ASGI app has not been started yet.");
806
+ const p = await t, v = p.pyodide, C = p.micropip, R = p.jedi, { moduleAutoLoad: w } = p.initData;
807
+ let L = await l;
808
+ const T = b.ports[0];
809
+ function S(g) {
810
+ T.postMessage(g);
811
+ }
812
+ function M(g) {
813
+ if (g.type !== "websocket.send")
814
+ return;
815
+ const f = g.bytes;
816
+ if (f) {
817
+ const P = f.buffer.slice(f.byteOffset, f.byteOffset + f.byteLength);
818
+ r({ type: "websocket:message", data: { payload: P } }, [P]);
819
+ return;
820
+ }
821
+ const _ = g.text;
822
+ typeof _ == "string" && r({ type: "websocket:message", data: { payload: _ } });
823
+ }
824
+ try {
825
+ switch (d.type) {
826
+ case "reboot": {
827
+ console.debug("Reboot the Streamlit server", d.data);
828
+ const { entrypoint: g } = d.data;
829
+ a && (await a.close(), a = null), await De(v, L), u.clear(), console.debug("Booting up the Streamlit ASGI app"), l = J(v, c, g), L = await l, console.debug("Booted up the Streamlit ASGI app"), S({
830
+ type: "reply"
831
+ });
832
+ break;
833
+ }
834
+ case "websocket:connect": {
835
+ console.debug("websocket:connect", d.data);
836
+ const { path: g } = d.data, f = u.getCookieHeader();
837
+ a && (await a.close(), a = null);
838
+ const _ = Ee({
839
+ path: g,
840
+ headers: {
841
+ host: "stlite.local",
842
+ origin: "http://stlite.local",
843
+ ...f ? { cookie: f } : {}
844
+ }
845
+ });
846
+ a = new Le(L.asgiApp, _, M), await a.start(), S({
847
+ type: "reply"
848
+ });
849
+ break;
850
+ }
851
+ case "websocket:send": {
852
+ console.debug("websocket:send", d.data);
853
+ const { payload: g } = d.data;
854
+ a && a.postClientMessage(g);
855
+ break;
856
+ }
857
+ case "http:request": {
858
+ console.debug("http:request", d.data);
859
+ const { request: g } = d.data;
860
+ h(L.asgiApp, g).then((f) => {
861
+ S({
862
+ type: "http:response",
863
+ data: {
864
+ response: {
865
+ statusCode: f.statusCode,
866
+ headers: new Map(f.headers.entries()),
867
+ body: f.body
868
+ }
869
+ }
870
+ });
871
+ }).catch((f) => {
872
+ console.error("http:request dispatch failed", f), S({
873
+ type: "http:response",
874
+ data: {
875
+ response: {
876
+ statusCode: 500,
877
+ headers: /* @__PURE__ */ new Map([
878
+ ["content-type", "text/plain; charset=utf-8"]
879
+ ]),
880
+ body: new TextEncoder().encode(`Internal server error: ${String(f)}`)
881
+ }
882
+ }
883
+ });
884
+ });
885
+ break;
886
+ }
887
+ case "file:write": {
888
+ const { path: g, data: f, opts: _ } = d.data, P = F(c, g);
889
+ w && typeof f == "string" && P.endsWith(".py") && (console.debug(`Auto install the requirements in ${P}`), Z(v, e, [f])), console.debug(`Write a file "${P}"`), Y(v, P, f, _), S({
890
+ type: "reply"
891
+ });
892
+ break;
893
+ }
894
+ case "file:rename": {
895
+ const { oldPath: g, newPath: f } = d.data, _ = F(c, g), P = F(c, f);
896
+ console.debug(`Rename "${_}" to ${P}`), fe(v, _, P), S({
897
+ type: "reply"
898
+ });
899
+ break;
900
+ }
901
+ case "file:unlink": {
902
+ const { path: g } = d.data, f = F(c, g);
903
+ console.debug(`Remove "${f}`), v.FS.unlink(f), S({
904
+ type: "reply"
905
+ });
906
+ break;
907
+ }
908
+ case "file:read": {
909
+ const { path: g, opts: f } = d.data;
910
+ console.debug(`Read "${g}"`);
911
+ const _ = v.FS.readFile(g, f);
912
+ S({
913
+ type: "reply:file:read",
914
+ data: {
915
+ content: _
916
+ }
917
+ });
918
+ break;
919
+ }
920
+ case "install": {
921
+ const { requirements: g, options: f } = d.data, _ = W(g);
922
+ console.debug("Install the requirements:", _), await C.install.callKwargs(_, f ?? {}).then(() => {
923
+ console.debug("Successfully installed"), S({
924
+ type: "reply"
925
+ });
926
+ });
927
+ break;
928
+ }
929
+ case "setEnv": {
930
+ const { env: g } = d.data;
931
+ v.pyimport("os").environ.update(v.toPy(g)), console.debug("Successfully set the environment variables", g), S({
932
+ type: "reply"
933
+ });
934
+ break;
935
+ }
936
+ case "code_completion": {
937
+ if (!R)
938
+ throw new Error("Jedi is not installed");
939
+ const { code: g, line: f, column: _ } = d.data, P = await Pe(R, g, {
940
+ line: f,
941
+ column: _
942
+ });
943
+ S({
944
+ type: "reply:code_completion",
945
+ data: {
946
+ codeCompletions: P
947
+ }
948
+ });
949
+ break;
950
+ }
951
+ case "run_python": {
952
+ const { code: g } = d.data;
953
+ console.debug("Run python code", g);
954
+ const f = await v.runPythonAsync(g);
955
+ let _;
956
+ f instanceof v.ffi.PyProxy ? (console.debug("The result is a PyProxy object"), _ = f.toJs(), f.destroy(), console.debug("Converted the result to a JS object", _)) : (_ = f, console.debug("The result is a JS primitive", _)), S({
957
+ type: "reply:run_python",
958
+ data: {
959
+ result: _
960
+ }
961
+ });
962
+ break;
963
+ }
964
+ case "add_mock_package": {
965
+ const { name: g, version: f, modules: _, persistent: P } = d.data;
966
+ console.debug("Add a mock package:", {
967
+ name: g,
968
+ version: f,
969
+ modules: _,
970
+ persistent: P
971
+ }), C.add_mock_package.callKwargs({
972
+ name: g,
973
+ version: f,
974
+ modules: v.toPy(_),
975
+ persistent: P
976
+ }), S({
977
+ type: "reply"
978
+ });
979
+ break;
980
+ }
981
+ }
982
+ } catch (g) {
983
+ if (console.error(g), !(g instanceof Error))
984
+ throw g;
985
+ const f = new Error(g.message);
986
+ f.name = g.name, f.stack = g.stack, S({
987
+ type: "reply",
988
+ error: f
989
+ });
990
+ }
991
+ };
992
+ return r({
993
+ type: "event:envSetup"
994
+ }), y;
995
+ }
996
+ const se = "abcdefghijklmnopqrstuvwxyz", je = se.length;
997
+ function Ue(o) {
998
+ let r = "";
999
+ for (let s = 0; s < o; s++) {
1000
+ const c = Math.floor(Math.random() * je);
1001
+ r += se[c];
1002
+ }
1003
+ return r;
1004
+ }
1005
+ const X = "https://cdn.jsdelivr.net/pyodide/v0.29.3/full/pyodide.mjs";
1006
+ if ("postMessage" in self)
1007
+ self.onmessage = G(X, (o, r) => r ? self.postMessage(o, r) : self.postMessage(o));
1008
+ else {
1009
+ const o = [];
1010
+ self.onconnect = (r) => {
1011
+ let s;
1012
+ do
1013
+ s = Ue(4);
1014
+ while (o.includes(s));
1015
+ o.push(s), console.debug("SharedWorker mode.", { appId: s });
1016
+ const c = r.ports[0];
1017
+ c.onmessage = G(X, (n, e) => e ? c.postMessage(n, e) : c.postMessage(n), void 0, s), c.start();
1018
+ };
1019
+ }
1020
+ //# sourceMappingURL=worker-BOAT2Vs2.js.map