@stlite/desktop 0.30.2 → 0.31.0

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 (50) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +31 -29
  3. package/build/index.html +1 -1
  4. package/build/static/js/2116.fd3de825.chunk.js +1 -0
  5. package/build/static/js/2523.4761d79a.chunk.js +5 -0
  6. package/build/static/js/2632.de1769ff.chunk.js +1 -0
  7. package/build/static/js/277.d9ceff66.chunk.js +1 -0
  8. package/build/static/js/3376.d5aaecc4.chunk.js +1 -0
  9. package/build/static/js/3392.5ed3420d.chunk.js +1 -0
  10. package/build/static/js/{3977.8a9ac9d7.chunk.js → 3977.24eb5fb8.chunk.js} +1 -1
  11. package/build/static/js/{4210.66c14600.chunk.js → 4210.945a5966.chunk.js} +1 -1
  12. package/build/static/js/{4514.ff4d47b7.chunk.js → 4514.7931bd64.chunk.js} +1 -1
  13. package/build/static/js/{464.8a875fdd.chunk.js → 464.7c22f33c.chunk.js} +1 -1
  14. package/build/static/js/5608.b4074ab9.chunk.js +1 -0
  15. package/build/static/js/{5678.b7f865a0.chunk.js → 5678.729bced9.chunk.js} +1 -1
  16. package/build/static/js/6223.4bb0039e.chunk.js +2 -0
  17. package/build/static/js/6223.4bb0039e.chunk.js.LICENSE.txt +11 -0
  18. package/build/static/js/{6422.f69a61a8.chunk.js → 6422.c2900a88.chunk.js} +1 -1
  19. package/build/static/js/{7073.33f107fd.chunk.js → 7073.0a198301.chunk.js} +1 -1
  20. package/build/static/js/7496.0f941cac.chunk.js +1 -0
  21. package/build/static/js/{761.e16e6486.chunk.js → 761.ca3883de.chunk.js} +1 -1
  22. package/build/static/js/7698.00f5ff0b.chunk.js +1 -0
  23. package/build/static/js/7858.e4a6aa6d.chunk.js +5 -0
  24. package/build/static/js/{7937.a3bc5cdb.chunk.js → 7937.4b1be66e.chunk.js} +1 -1
  25. package/build/static/js/{8355.7352ad1b.chunk.js → 8355.b110abc9.chunk.js} +1 -1
  26. package/build/static/js/{8461.87a9a578.chunk.js → 8461.85faefa1.chunk.js} +1 -1
  27. package/build/static/js/9462.81f9c52a.chunk.js +1 -0
  28. package/build/static/js/9551.c45b17cf.chunk.js +1 -0
  29. package/build/static/js/main.1add465f.js +28 -0
  30. package/build/static/js/{main.4ee8ce64.js.LICENSE.txt → main.1add465f.js.LICENSE.txt} +1 -3
  31. package/build/static/media/checkmark.29851c8e9e6ef0c3d6c1e4efe3c1bb9e.svg +3 -0
  32. package/build/static/media/logo.83ae4f2fb87e38be7cbb8a5d2beb64d2.svg +5 -0
  33. package/build/static/media/rocket.b75b17d2b0a063c6cea230d1a9d77f1e.svg +9 -0
  34. package/package.json +4 -4
  35. package/build/static/js/2116.2e449b06.chunk.js +0 -1
  36. package/build/static/js/2523.7919ada5.chunk.js +0 -5
  37. package/build/static/js/2632.1bb45c13.chunk.js +0 -1
  38. package/build/static/js/277.fbace0b9.chunk.js +0 -1
  39. package/build/static/js/3376.839fa3bf.chunk.js +0 -1
  40. package/build/static/js/3392.7b32c75f.chunk.js +0 -1
  41. package/build/static/js/458.895bbb73.chunk.js +0 -1
  42. package/build/static/js/5608.314b94e4.chunk.js +0 -1
  43. package/build/static/js/6928.228563da.chunk.js +0 -2
  44. package/build/static/js/6928.228563da.chunk.js.LICENSE.txt +0 -26
  45. package/build/static/js/7496.37614377.chunk.js +0 -1
  46. package/build/static/js/7698.095351a0.chunk.js +0 -1
  47. package/build/static/js/7858.fa281cb7.chunk.js +0 -5
  48. package/build/static/js/9462.ebffc855.chunk.js +0 -1
  49. package/build/static/js/9551.f6ae672e.chunk.js +0 -1
  50. package/build/static/js/main.4ee8ce64.js +0 -28
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * https://github.com/Starcounter-Jack/JSON-Patch
3
+ * (c) 2017-2021 Joachim Wester
4
+ * MIT license
5
+ */
6
+
7
+ /*!
8
+ * https://github.com/Starcounter-Jack/JSON-Patch
9
+ * (c) 2017-2022 Joachim Wester
10
+ * MIT licensed
11
+ */
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6422],{46422:(e,t,s)=>{s.r(t),s.d(t,{default:()=>v});var i=s(5057),a=s(9187),o=s.n(a),r=s(31476),n=s(42458),l=s(9191),d=s(73830),p=s(56846),m=s(86964),h=s(8429),u=s(54840),g=s(34422),c=s(96266);const f="YYYY/MM/DD";function y(e){return e.map((e=>new Date(e)))}class b extends i.PureComponent{constructor(...e){super(...e),this.formClearHelper=new p.Kz,this.state={values:this.initialValue,isRange:this.props.element.isRange,isEmpty:!1},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringArrayValue(this.props.element,this.state.values.map((e=>o()(e).format(f))),e)},this.onFormCleared=()=>{const e=y(this.props.element.default);this.setState({values:e},(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=({date:e})=>{if(null===e||void 0===e)return void this.setState({values:[],isEmpty:!0});const t=[];Array.isArray(e)?e.forEach((e=>{e&&t.push(e)})):t.push(e),this.setState({values:t,isEmpty:!t},(()=>{this.state.isEmpty||this.commitWidgetValue({fromUi:!0})}))},this.handleClose=()=>{const{isEmpty:e}=this.state;e&&this.setState(((e,t)=>({values:y(t.element.default),isEmpty:!y(t.element.default)})),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.getMaxDate=()=>{const{element:e}=this.props,t=e.max;return t&&t.length>0?o()(t,f).toDate():void 0}}get initialValue(){const e=this.props.widgetMgr.getStringArrayValue(this.props.element);return y(void 0!==e?e:this.props.element.default)}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({values:e.map((e=>new Date(e)))},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{width:t,element:s,disabled:i,theme:a,widgetMgr:r}=this.props,{values:p,isRange:y}=this.state,{colors:b,fontSizes:v,lineHeights:C}=a,x={width:t},V=o()(s.min,f).toDate(),D=this.getMaxDate();return this.formClearHelper.manageFormClearListener(r,s.formId,this.onFormCleared),(0,c.jsxs)("div",{className:"stDateInput",style:x,children:[(0,c.jsx)(m.ON,{label:s.label,disabled:i,labelVisibility:(0,g.iF)(null===(e=s.labelVisibility)||void 0===e?void 0:e.value),children:s.help&&(0,c.jsx)(m.dT,{children:(0,c.jsx)(h.Z,{content:s.help,placement:u.ug.TOP_RIGHT})})}),(0,c.jsx)(n.Z,{density:l.pw.high,formatString:"yyyy/MM/dd",disabled:i,onChange:this.handleChange,onClose:this.handleClose,overrides:{Popover:{props:{placement:d.r4.bottomLeft,overrides:{Body:{style:{border:`1px solid ${b.fadedText10}`}}}}},CalendarContainer:{style:{fontSize:v.sm,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},Week:{style:{fontSize:v.sm}},Day:{style:{fontSize:v.sm,lineHeight:C.base,"::after":{borderColor:b.transparent}}},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:b.transparent},":focus":{backgroundColor:b.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:b.transparent},":focus":{backgroundColor:b.transparent,outline:0}}},Input:{props:{maskChar:null,overrides:{Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Input:{style:{paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}}}}}},value:p,minDate:V,maxDate:D,range:y})]})}}const v=(0,r.b)(b)}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6422],{46422:(e,t,s)=>{s.r(t),s.d(t,{default:()=>v});var i=s(5057),a=s(9187),o=s.n(a),r=s(31476),n=s(42458),l=s(9191),d=s(73830),p=s(56846),m=s(86964),h=s(8429),u=s(54840),g=s(34422),c=s(96266);const f="YYYY/MM/DD";function y(e){return e.map((e=>new Date(e)))}class b extends i.PureComponent{constructor(...e){super(...e),this.formClearHelper=new p.Kz,this.state={values:this.initialValue,isRange:this.props.element.isRange,isEmpty:!1},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringArrayValue(this.props.element,this.state.values.map((e=>o()(e).format(f))),e)},this.onFormCleared=()=>{const e=y(this.props.element.default);this.setState({values:e},(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=({date:e})=>{if(null===e||void 0===e)return void this.setState({values:[],isEmpty:!0});const t=[];Array.isArray(e)?e.forEach((e=>{e&&t.push(e)})):t.push(e),this.setState({values:t,isEmpty:!t},(()=>{this.state.isEmpty||this.commitWidgetValue({fromUi:!0})}))},this.handleClose=()=>{const{isEmpty:e}=this.state;e&&this.setState(((e,t)=>({values:y(t.element.default),isEmpty:!y(t.element.default)})),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.getMaxDate=()=>{const{element:e}=this.props,t=e.max;return t&&t.length>0?o()(t,f).toDate():void 0}}get initialValue(){const e=this.props.widgetMgr.getStringArrayValue(this.props.element);return y(void 0!==e?e:this.props.element.default)}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({values:e.map((e=>new Date(e)))},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{width:t,element:s,disabled:i,theme:a,widgetMgr:r}=this.props,{values:p,isRange:y}=this.state,{colors:b,fontSizes:v,lineHeights:C}=a,x={width:t},V=o()(s.min,f).toDate(),D=this.getMaxDate();return this.formClearHelper.manageFormClearListener(r,s.formId,this.onFormCleared),(0,c.jsxs)("div",{className:"stDateInput",style:x,children:[(0,c.jsx)(m.ON,{label:s.label,disabled:i,labelVisibility:(0,g.iF)(null===(e=s.labelVisibility)||void 0===e?void 0:e.value),children:s.help&&(0,c.jsx)(m.dT,{children:(0,c.jsx)(h.ZP,{content:s.help,placement:u.ug.TOP_RIGHT})})}),(0,c.jsx)(n.Z,{density:l.pw.high,formatString:"yyyy/MM/dd",disabled:i,onChange:this.handleChange,onClose:this.handleClose,overrides:{Popover:{props:{placement:d.r4.bottomLeft,overrides:{Body:{style:{border:`1px solid ${b.fadedText10}`}}}}},CalendarContainer:{style:{fontSize:v.sm,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},Week:{style:{fontSize:v.sm}},Day:{style:{fontSize:v.sm,lineHeight:C.base,"::after":{borderColor:b.transparent}}},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:b.transparent},":focus":{backgroundColor:b.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:b.transparent},":focus":{backgroundColor:b.transparent,outline:0}}},Input:{props:{maskChar:null,overrides:{Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Input:{style:{paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}}}}}},value:p,minDate:V,maxDate:D,range:y})]})}}const v=(0,r.b)(b)}}]);
@@ -1 +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 u=e.charCodeAt(o+g);if(u!==r.charCodeAt(i+g))break;47===u&&(d=g)}var p="";for(g=o+d+1;g<=s;++g)g!==s&&47!==e.charCodeAt(g)||(0===p.length?p+="..":p+="/..");return p.length>0?p+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;!function(e){function t(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e}function r(e){return Array.isArray(e)}function n(e,o){if(e===o)return!0;if(t(e)||t(o))return!1;var s=r(e),a=r(o);return s===a&&(s&&a?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0,o=e.length;r<o;++r)if(!n(e[r],t[r]))return!1;return!0}(e,o):function(e,t){if(e===t)return!0;for(var r in e)if(void 0!==e[r]&&!(r in t))return!1;for(var r in t)if(void 0!==t[r]&&!(r in e))return!1;for(var r in e){var o=e[r],s=t[r];if(void 0!==o||void 0!==s){if(void 0===o||void 0===s)return!1;if(!n(o,s))return!1}}return!0}(e,o))}function o(e){return t(e)?e:r(e)?function(e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)t[r]=o(e[r]);return t}(e):function(e){var t={};for(var r in e){var n=e[r];void 0!==n&&(t[r]=o(n))}return t}(e)}e.emptyObject=Object.freeze({}),e.emptyArray=Object.freeze([]),e.isPrimitive=t,e.isArray=r,e.isObject=function(e){return!t(e)&&!r(e)},e.deepEqual=n,e.deepCopy=o}(e||(e={}));!function(){function e(){this._types=[],this._values=[]}e.prototype.types=function(){return this._types.slice()},e.prototype.hasData=function(e){return-1!==this._types.indexOf(e)},e.prototype.getData=function(e){var t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0},e.prototype.setData=function(e,t){this.clearData(e),this._types.push(e),this._values.push(t)},e.prototype.clearData=function(e){var t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))},e.prototype.clear=function(){this._types.length=0,this._values.length=0}}();var t,n,o=function(){function e(){var e=this;this.promise=new Promise((function(t,r){e._resolve=t,e._reject=r}))}return e.prototype.resolve=function(e){(0,this._resolve)(e)},e.prototype.reject=function(e){(0,this._reject)(e)},e}();function s(e){for(var t=0,r=0,n=e.length;r<n;++r)r%4===0&&(t=4294967295*Math.random()>>>0),e[r]=255&t,t>>>=8}!function(e){e.getRandomValues=function(){var e="undefined"!==typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"===typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:s}()}(t||(t={})),function(e){e.uuid4=function(e){for(var t=new Uint8Array(16),r=new Array(256),n=0;n<16;++n)r[n]="0"+n.toString(16);for(n=16;n<256;++n)r[n]=n.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],r[t[0]]+r[t[1]]+r[t[2]]+r[t[3]]+"-"+r[t[4]]+r[t[5]]+"-"+r[t[6]]+r[t[7]]+"-"+r[t[8]]+r[t[9]]+"-"+r[t[10]]+r[t[11]]+r[t[12]]+r[t[13]]+r[t[14]]+r[t[15]]}}(t.getRandomValues)}(n||(n={}));var a=r(56977),i=r.n(a);function l(e,t){const r=i().normalize(t),n=i().dirname(r).split("/"),o=[];for(const a of n){o.push(a);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(s){throw console.error(`Failed to create a directory "${t}"`),s}}}function c(e,t,r,n){l(e,t),e.FS.writeFile(t,r,n)}function d(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 g(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 u=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 p,f;const h=self,m=new o;function y(e){h.postMessage({type:"event:progress",data:{message:e}})}const v=function(){return u(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,requirements:r,wheels:n,mountedSitePackagesSnapshotFilePath:o,pyodideEntrypointUrl:s}=yield m.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==s&&void 0!==s?s:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),p=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),Object.keys(t).forEach((e=>{const{data:r,opts:n}=t[e];console.debug(`Write a file "${e}"`),c(p,e,r,n)})),o)y("Restoring the snapshot."),yield p.runPythonAsync("import tarfile, shutil, site"),yield p.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${o}`),yield p.runPythonAsync(`\n with tarfile.open("${o}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow");else{if(!n)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield p.loadPackage("micropip");const e=p.pyimport("micropip");yield e.install.callKwargs([n.stliteServer],{keep_going:!0}),yield e.install.callKwargs([n.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow"),y("Installing the requirements."),console.debug("Installing the requirements:",r),d(r),yield e.install.callKwargs(r,{keep_going:!0}),console.debug("Installed the requirements:",r)}}yield p.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield p.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield p.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 p.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"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield p.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"),y("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),yield p.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n })\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"),f=p.globals.get("server").copy(),console.debug("Set up the HTTP server"),h.postMessage({type:"event:loaded"})}))}().catch((e=>{throw h.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>u(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);yield v;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;f.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);h.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else h.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;f.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)};f.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:o}=t.data;console.debug(`Write a file "${e}"`),c(p,e,n,o),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:n}=t.data;console.debug(`Rename "${e}" to ${n}`),function(e,t,r){l(e,r),e.FS.rename(t,r)}(p,e,n),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),p.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=p.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return p.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(n){r.postMessage({type:"reply",error:n})}})),h.postMessage({type:"event:start"})})()})();
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 u=e.charCodeAt(o+g);if(u!==r.charCodeAt(i+g))break;47===u&&(d=g)}var p="";for(g=o+d+1;g<=s;++g)g!==s&&47!==e.charCodeAt(g)||(0===p.length?p+="..":p+="/..");return p.length>0?p+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;!function(e){function t(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e}function r(e){return Array.isArray(e)}function n(e,o){if(e===o)return!0;if(t(e)||t(o))return!1;var s=r(e),a=r(o);return s===a&&(s&&a?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0,o=e.length;r<o;++r)if(!n(e[r],t[r]))return!1;return!0}(e,o):function(e,t){if(e===t)return!0;for(var r in e)if(void 0!==e[r]&&!(r in t))return!1;for(var r in t)if(void 0!==t[r]&&!(r in e))return!1;for(var r in e){var o=e[r],s=t[r];if(void 0!==o||void 0!==s){if(void 0===o||void 0===s)return!1;if(!n(o,s))return!1}}return!0}(e,o))}function o(e){return t(e)?e:r(e)?function(e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)t[r]=o(e[r]);return t}(e):function(e){var t={};for(var r in e){var n=e[r];void 0!==n&&(t[r]=o(n))}return t}(e)}e.emptyObject=Object.freeze({}),e.emptyArray=Object.freeze([]),e.isPrimitive=t,e.isArray=r,e.isObject=function(e){return!t(e)&&!r(e)},e.deepEqual=n,e.deepCopy=o}(e||(e={}));!function(){function e(){this._types=[],this._values=[]}e.prototype.types=function(){return this._types.slice()},e.prototype.hasData=function(e){return-1!==this._types.indexOf(e)},e.prototype.getData=function(e){var t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0},e.prototype.setData=function(e,t){this.clearData(e),this._types.push(e),this._values.push(t)},e.prototype.clearData=function(e){var t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))},e.prototype.clear=function(){this._types.length=0,this._values.length=0}}();var t,n,o=function(){function e(){var e=this;this.promise=new Promise((function(t,r){e._resolve=t,e._reject=r}))}return e.prototype.resolve=function(e){(0,this._resolve)(e)},e.prototype.reject=function(e){(0,this._reject)(e)},e}();function s(e){for(var t=0,r=0,n=e.length;r<n;++r)r%4===0&&(t=4294967295*Math.random()>>>0),e[r]=255&t,t>>>=8}!function(e){e.getRandomValues=function(){var e="undefined"!==typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"===typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:s}()}(t||(t={})),function(e){e.uuid4=function(e){for(var t=new Uint8Array(16),r=new Array(256),n=0;n<16;++n)r[n]="0"+n.toString(16);for(n=16;n<256;++n)r[n]=n.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],r[t[0]]+r[t[1]]+r[t[2]]+r[t[3]]+"-"+r[t[4]]+r[t[5]]+"-"+r[t[6]]+r[t[7]]+"-"+r[t[8]]+r[t[9]]+"-"+r[t[10]]+r[t[11]]+r[t[12]]+r[t[13]]+r[t[14]]+r[t[15]]}}(t.getRandomValues)}(n||(n={}));var a=r(56977),i=r.n(a);function l(e,t){const r=i().normalize(t),n=i().dirname(r).split("/"),o=[];for(const a of n){o.push(a);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(s){throw console.error(`Failed to create a directory "${t}"`),s}}}function c(e,t,r,n){l(e,t),e.FS.writeFile(t,r,n)}function d(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 g(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 u=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 p,f;const h=self,m=new o;function y(e){h.postMessage({type:"event:progress",data:{message:e}})}const v=function(){return u(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,requirements:r,wheels:n,mountedSitePackagesSnapshotFilePath:o,pyodideEntrypointUrl:s}=yield m.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==s&&void 0!==s?s:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),p=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),Object.keys(t).forEach((e=>{const{data:r,opts:n}=t[e];console.debug(`Write a file "${e}"`),c(p,e,r,n)})),o)y("Restoring the snapshot."),yield p.runPythonAsync("import tarfile, shutil, site"),yield p.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${o}`),yield p.runPythonAsync(`\n with tarfile.open("${o}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow");else{if(!n)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield p.loadPackage("micropip");const e=p.pyimport("micropip");yield e.install.callKwargs([n.stliteServer],{keep_going:!0}),yield e.install.callKwargs([n.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow"),y("Installing the requirements."),console.debug("Installing the requirements:",r),d(r),yield e.install.callKwargs(r,{keep_going:!0}),console.debug("Installed the requirements:",r)}}yield p.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield p.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield p.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 p.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"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield p.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"),y("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),yield p.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n "runner.fastReruns": False, # Fast reruns do not work well with the async script runner of stlite. See https://github.com/whitphx/stlite/pull/550#issuecomment-1505485865.\n })\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"),f=p.globals.get("server").copy(),console.debug("Set up the HTTP server"),h.postMessage({type:"event:loaded"})}))}().catch((e=>{throw h.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>u(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);yield v;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;f.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);h.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else h.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;f.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)};f.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:o}=t.data;console.debug(`Write a file "${e}"`),c(p,e,n,o),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:n}=t.data;console.debug(`Rename "${e}" to ${n}`),function(e,t,r){l(e,r),e.FS.rename(t,r)}(p,e,n),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),p.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=p.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return p.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(n){r.postMessage({type:"reply",error:n})}})),h.postMessage({type:"event:start"})})()})();
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7496],{77390:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(5057),r=s(31476),o=s(63),n=s(99362),a=s(16449),l=s(80099),d=s(96266);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function({value:e,width:t,size:s=c.SMALL,overrides:h}){const g=(0,r.u)(),u={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:p}=i.useContext(o.I),m=!(0,n.MJ)(p),f={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:({$theme:e})=>({width:t?t.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:u[s],backgroundColor:e.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})},BarProgress:{style:()=>({backgroundColor:m?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(a.Z,{value:e,overrides:(0,l.aO)(f,h)})}},77496:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(30967),o=s(10458),n=s.n(o),a=s(65873),l=s.n(a),d=s(5057),c=s(32291),h=s(97292),g=s(54840),u=s(8429),p=s(86964),m=s(56846),f=s(52801),S=s(34422),w=s(41605),x=s(77390),R=s(45490),b=s(59990);function F(e,t){switch(e){case i.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case i.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case i.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const C=(0,R.Z)("div",{target:"ejtjsn29"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),I=(0,R.Z)("div",{target:"ejtjsn28"})((({theme:e,width:t})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.md} ${e.radii.md} 0 0`,width:"100%",height:9*t/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),""),j=(0,R.Z)("p",{target:"ejtjsn27"})((({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),""),v=(0,R.Z)("img",{target:"ejtjsn26"})((({theme:e,opacity:t})=>({borderRadius:`${e.radii.md} ${e.radii.md} 0 0`,objectFit:"contain",opacity:t})),""),E=(0,R.Z)("a",{target:"ejtjsn25"})((({theme:e})=>({color:e.colors.primary,display:"block",textDecoration:"none"})),""),P=(0,R.Z)("span",{target:"ejtjsn24"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,R.Z)("div",{target:"ejtjsn23"})((({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:1,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),""),M=(0,R.Z)("div",{target:"ejtjsn21"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),y=(0,R.Z)("button",{target:"ejtjsn20"})((({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`1px solid ${e.colors.fadedText10}`,borderRadius:`0 0 ${e.radii.md} ${e.radii.md}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:0,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{boxShadow:`0 0 0 0.2rem ${(0,b.DZ)(e.colors.primary,.5)}`,outline:"none"},...F(i.MEDIUM,e)})),"");var L=s(96266);const U=function({disabled:e,onClick:t,children:s,progress:i}){return(0,L.jsxs)(y,{disabled:e||!1,onClick:t||(()=>{}),progress:i||null,"data-testid":"stCameraInputButton",children:[s,i&&(0,L.jsx)(M,{children:(0,L.jsx)(x.Z,{value:i,size:x.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(90693),$=s(92445),Z=s(3579);let D;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(D||(D={}));const X=({switchFacingMode:e})=>(0,L.jsx)(T,{children:(0,L.jsx)(g.ZP,{content:"Switch camera",placement:g.ug.TOP_RIGHT,children:(0,L.jsx)($.ZP,{kind:$.hY.MINIMAL,onClick:e,children:(0,L.jsx)(h.ZP,{content:k.Z,size:"twoXL",color:Z.Z.white})})})});var O=s(85585),_=s(31476),A=s(11226),B=s(74947),N=s.n(B),z=s(92371);let G;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(G||(G={}));const V=({width:e})=>(0,L.jsxs)(I,{width:e,children:[(0,L.jsx)(h.ZP,{size:"threeXL",color:Z.Z.gray60,content:O.n}),(0,L.jsxs)(j,{children:["This app would like to use your camera.",(0,L.jsx)(E,{href:z.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),W=({handleCapture:e,width:t,disabled:s,clearPhotoInProgress:i,setClearPhotoInProgress:r,facingMode:o,setFacingMode:n})=>{const[a,l]=(0,d.useState)(G.PENDING),c=(0,d.useRef)(null),[h,g]=(0,d.useState)(t),u=(0,d.useCallback)((0,S.Ds)(1e3,g),[]);(0,d.useEffect)((()=>{u(t)}),[t]);const p=(0,_.u)();return(0,L.jsxs)(C,{width:h,children:[a===G.SUCCESS||s||i?A.tq&&(0,L.jsx)(X,{switchFacingMode:n}):(0,L.jsx)(V,{width:h}),(0,L.jsx)(I,{hidden:a!==G.SUCCESS&&!s&&!i,width:h,children:!s&&(0,L.jsx)(N(),{audio:!1,ref:c,screenshotFormat:"image/jpeg",screenshotQuality:1,width:h,height:9*h/16,style:{borderRadius:`${p.radii.md} ${p.radii.md} 0 0`},onUserMediaError:()=>{l(G.ERROR)},onUserMedia:()=>{l(G.SUCCESS),r(!1)},videoConstraints:{width:{ideal:h},facingMode:o}})}),(0,L.jsx)(U,{onClick:function(){if(null!==c.current){const t=c.current.getScreenshot();e(t)}},disabled:a!==G.SUCCESS||s||i,children:"Take Photo"})]})};class H extends d.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.Kz,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===D.USER?D.ENVIRONMENT:D.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,s;return(t=e,s=`camera-input-${(new Date).toISOString().replace(/:/g,"_")}.jpg`,fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.uploadFile(e))).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.H)(e)}))},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=e=>{const{element:t,widgetMgr:s}=this.props;if(e.disabled!==this.props.disabled&&this.props.disabled)return this.reset(),void s.setFileUploaderStateValue(t,new c.xO,{fromUi:!1});if("ready"!==this.status)return;const i=this.createWidgetValue();if(void 0===i)return;const r=s.getFileUploaderStateValue(t);l().isEqual(i,r)||s.setFileUploaderStateValue(t,i,{fromUi:!0})},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&(this.setState({imgSrc:null}),this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0}))}))},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((e=>({newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",serverFileId:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=e=>{const t=n().CancelToken.source(),s=new w.R(e.name,e.size,this.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e,(e=>this.onUploadProgress(e,s.id)),t.token).then((e=>this.onUploadComplete(s.id,e))).catch((e=>{n().isCancel(e)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:D.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{maxFileId:r,uploadedFileInfo:o}=i;return null==r||0===r||null==o?e:{files:o.map((e=>{const t=e.name,s=e.size,i=e.id;return new w.R(t,s,this.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(r),imgSrc:0===o.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:D.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}createWidgetValue(){if(0===this.state.newestServerFileId)return;const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new c.jM({id:i.serverFileId,name:t,size:s})}));return new c.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,L.jsxs)(C,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,L.jsx)(p.ON,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,L.jsx)(p.dT,{children:(0,L.jsx)(u.ZP,{content:t.help,placement:g.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(I,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,L.jsx)(v,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,L.jsx)(U,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,L.jsxs)(P,{children:[(0,L.jsx)(h.ZP,{content:r.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,L.jsx)(W,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=H},41605:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[761],{40761:(e,t,r)=>{r.r(t),r.d(t,{default:()=>se});var o=r(5057),n=r(31476),i=r(80099),a=r(53381);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=0,p=1,d=2;function f(e){return e.$isActive?d:e.$isHovered?p:u}function h(e){var t=e.$theme.colors,r=e.$disabled,o=e.$checked,n=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!o)return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(f(e)){case u:return t.tickFillErrorSelected;case p:return t.tickFillErrorSelectedHover;case d:return t.tickFillErrorSelectedHoverActive}else switch(f(e)){case u:return t.tickFillSelected;case p:return t.tickFillSelectedHover;case d:return t.tickFillSelectedHoverActive}return null}function b(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(f(e)){case u:return t.tickFillError;case p:return t.tickFillErrorHover;case d:return t.tickFillErrorHoverActive}else switch(f(e)){case u:return t.tickFill;case p:return t.tickFillHover;case d:return t.tickFillActive}}function m(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var y=(0,a.zo)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));y.displayName="RadioGroupRoot",y.displayName="RadioGroupRoot";var v=(0,a.zo)("label",(function(e){var t,r=e.$disabled,o=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return c(t={flexDirection:"top"===n||"bottom"===n?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),c(t,"marginBottom",o&&!l?null:s.scale200),t}));v.displayName="Root",v.displayName="Root";var g=(0,a.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{backgroundColor:b(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?o.scale200:o.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?o.scale200:o.scale550}}));g.displayName="RadioMarkInner",g.displayName="RadioMarkInner";var w=(0,a.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{alignItems:"center",backgroundColor:h(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:o.scale700,justifyContent:"center",marginTop:o.scale0,marginRight:o.scale0,marginBottom:o.scale0,marginLeft:o.scale0,outline:"none",verticalAlign:"middle",width:o.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));w.displayName="RadioMarkOuter",w.displayName="RadioMarkOuter";var O=(0,a.zo)("div",(function(e){var t=e.$theme.typography;return l(l({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,n=e.$theme;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===n.direction?"Left":"Right";break;default:t="rtl"===n.direction?"Right":"Left"}var i=n.sizing.scale300;return c({},"padding".concat(t),i)}(e)),{},{color:m(e)},t.LabelMedium)}));O.displayName="Label",O.displayName="Label";var R=(0,a.zo)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});R.displayName="Input",R.displayName="Input";var k=(0,a.zo)("div",(function(e){var t,r=e.$theme,o=e.$align,n="horizontal"===o,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return l(l({},r.typography.ParagraphSmall),{},(c(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===o?null:r.sizing.scale900),c(t,"margin".concat(a),n?r.sizing.scale200:null),c(t,"maxWidth","240px"),t))}));k.displayName="Description",k.displayName="Description";var j=r(94253);function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function P(){return P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},P.apply(this,arguments)}function $(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function M(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function E(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=I(e);if(t){var n=I(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===F(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}(this,r)}}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(s,e);var t,r,n,a=E(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return L(C(e=a.call.apply(a,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),L(C(e),"handleFocus",(function(t,r){(0,j.E)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),L(C(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=s,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,n=$((0,i.jb)(r.RadioGroupRoot,y),2),a=n[0],s=n[1];return o.createElement(a,P({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},s),o.Children.map(this.props.children,(function(t,r){if(!o.isValidElement(t))return null;var n=e.props.value===t.props.value;return o.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:n,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||n?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&M(t.prototype,r),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);L(T,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});const B=T;var D="vertical",V="horizontal";function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},z.apply(this,arguments)}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function N(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function W(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=G(e);if(t){var n=G(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===A(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}(this,r)}}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z=function(e){return e.stopPropagation()},J=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}(s,e);var t,r,n,a=W(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return K(q(e=a.call.apply(a,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),K(q(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),K(q(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),K(q(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),K(q(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=s,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,n=_((0,i.jb)(r.Root,v),2),a=n[0],s=n[1],l=_((0,i.jb)(r.Label,O),2),c=l[0],u=l[1],p=_((0,i.jb)(r.Input,R),2),d=p[0],f=p[1],h=_((0,i.jb)(r.Description,k),2),b=h[0],m=h[1],y=_((0,i.jb)(r.RadioMarkInner,g),2),j=y[0],F=y[1],P=_((0,i.jb)(r.RadioMarkOuter,w),2),$=P[0],S=P[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},x=o.createElement(c,z({},M,u),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return o.createElement(o.Fragment,null,o.createElement(a,z({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,s),("top"===(e=this.props.labelPlacement)||"left"===e)&&x,o.createElement($,z({},M,S),o.createElement(j,z({},M,F))),o.createElement(d,z({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:Z,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&x),!!this.props.description&&o.createElement(b,z({},M,m),this.props.description))}}])&&N(t.prototype,r),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);K(J,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:o.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const Q=J;var X=r(86964),Y=r(8429),ee=r(54840),te=r(96266);class re extends o.PureComponent{constructor(...e){super(...e),this.state={value:this.props.value},this.onChange=e=>{const t=parseInt(e.target.value,10);this.setState({value:t},(()=>this.props.onChange(t)))}}componentDidUpdate(e){e.value!==this.props.value&&this.props.value!==this.state.value&&this.setState(((e,t)=>({value:t.value})))}render(){const{theme:e,width:t,help:r,label:o,horizontal:n,labelVisibility:i}=this.props;let{disabled:a}=this.props;const{colors:s,radii:l}=e,c={width:t},u=[...this.props.options];return 0===u.length&&(u.push("No options to select."),a=!0),(0,te.jsxs)("div",{className:"row-widget stRadio",style:c,children:[(0,te.jsx)(X.ON,{label:o,disabled:a,labelVisibility:i,children:r&&(0,te.jsx)(X.Hp,{children:(0,te.jsx)(Y.Z,{content:r,placement:ee.ug.TOP_RIGHT})})}),(0,te.jsx)(B,{onChange:this.onChange,value:this.state.value.toString(),disabled:a,align:n?V:D,"aria-label":o,children:u.map(((e,t)=>(0,te.jsx)(Q,{value:t.toString(),overrides:{Root:{style:({$isFocusVisible:e})=>({marginBottom:0,marginTop:0,marginRight:"1rem",paddingLeft:0,alignItems:"start",paddingRight:"2px",backgroundColor:e?s.darkenedBgMix25:"",borderTopLeftRadius:l.md,borderTopRightRadius:l.md,borderBottomLeftRadius:l.md,borderBottomRightRadius:l.md})},RadioMarkOuter:{style:({$checked:e})=>({width:"1rem",height:"1rem",marginTop:"0.35rem",marginRight:"0",backgroundColor:e&&!a?s.primary:s.fadedText40})},RadioMarkInner:{style:({$checked:e})=>({height:e?"6px":".75rem",width:e?"6px":".75rem"})},Label:{style:{color:a?s.fadedText40:s.bodyText,position:"relative",top:"1px"}}},children:e},t)))})]})}}const oe=(0,n.b)(re);var ne=r(56846),ie=r(34422);class ae extends o.PureComponent{constructor(...e){super(...e),this.formClearHelper=new ne.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setIntValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.setState({value:e},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getIntValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){const{disabled:e,element:t,width:r,widgetMgr:o}=this.props,{horizontal:n,options:i,label:a,labelVisibility:s,help:l}=t;return this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared),(0,te.jsx)(oe,{label:a,onChange:this.onChange,options:i,width:r,disabled:e,horizontal:n,labelVisibility:(0,ie.iF)(null===s||void 0===s?void 0:s.value),value:this.state.value,help:l})}}const se=ae}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[761],{40761:(e,t,r)=>{r.r(t),r.d(t,{default:()=>se});var o=r(5057),n=r(31476),i=r(80099),a=r(53381);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=0,p=1,d=2;function f(e){return e.$isActive?d:e.$isHovered?p:u}function h(e){var t=e.$theme.colors,r=e.$disabled,o=e.$checked,n=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!o)return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(f(e)){case u:return t.tickFillErrorSelected;case p:return t.tickFillErrorSelectedHover;case d:return t.tickFillErrorSelectedHoverActive}else switch(f(e)){case u:return t.tickFillSelected;case p:return t.tickFillSelectedHover;case d:return t.tickFillSelectedHoverActive}return null}function b(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(f(e)){case u:return t.tickFillError;case p:return t.tickFillErrorHover;case d:return t.tickFillErrorHoverActive}else switch(f(e)){case u:return t.tickFill;case p:return t.tickFillHover;case d:return t.tickFillActive}}function m(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var y=(0,a.zo)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));y.displayName="RadioGroupRoot",y.displayName="RadioGroupRoot";var v=(0,a.zo)("label",(function(e){var t,r=e.$disabled,o=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return c(t={flexDirection:"top"===n||"bottom"===n?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),c(t,"marginBottom",o&&!l?null:s.scale200),t}));v.displayName="Root",v.displayName="Root";var g=(0,a.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{backgroundColor:b(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?o.scale200:o.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?o.scale200:o.scale550}}));g.displayName="RadioMarkInner",g.displayName="RadioMarkInner";var w=(0,a.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{alignItems:"center",backgroundColor:h(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:o.scale700,justifyContent:"center",marginTop:o.scale0,marginRight:o.scale0,marginBottom:o.scale0,marginLeft:o.scale0,outline:"none",verticalAlign:"middle",width:o.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));w.displayName="RadioMarkOuter",w.displayName="RadioMarkOuter";var O=(0,a.zo)("div",(function(e){var t=e.$theme.typography;return l(l({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,n=e.$theme;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===n.direction?"Left":"Right";break;default:t="rtl"===n.direction?"Right":"Left"}var i=n.sizing.scale300;return c({},"padding".concat(t),i)}(e)),{},{color:m(e)},t.LabelMedium)}));O.displayName="Label",O.displayName="Label";var R=(0,a.zo)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});R.displayName="Input",R.displayName="Input";var k=(0,a.zo)("div",(function(e){var t,r=e.$theme,o=e.$align,n="horizontal"===o,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return l(l({},r.typography.ParagraphSmall),{},(c(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===o?null:r.sizing.scale900),c(t,"margin".concat(a),n?r.sizing.scale200:null),c(t,"maxWidth","240px"),t))}));k.displayName="Description",k.displayName="Description";var j=r(94253);function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function P(){return P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},P.apply(this,arguments)}function $(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function M(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function E(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=I(e);if(t){var n=I(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===F(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}(this,r)}}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(s,e);var t,r,n,a=E(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return L(C(e=a.call.apply(a,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),L(C(e),"handleFocus",(function(t,r){(0,j.E)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),L(C(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=s,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,n=$((0,i.jb)(r.RadioGroupRoot,y),2),a=n[0],s=n[1];return o.createElement(a,P({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},s),o.Children.map(this.props.children,(function(t,r){if(!o.isValidElement(t))return null;var n=e.props.value===t.props.value;return o.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:n,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||n?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&M(t.prototype,r),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);L(T,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});const B=T;var D="vertical",V="horizontal";function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},z.apply(this,arguments)}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function N(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function W(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=G(e);if(t){var n=G(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===A(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}(this,r)}}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z=function(e){return e.stopPropagation()},J=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}(s,e);var t,r,n,a=W(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return K(q(e=a.call.apply(a,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),K(q(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),K(q(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),K(q(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),K(q(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=s,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,n=_((0,i.jb)(r.Root,v),2),a=n[0],s=n[1],l=_((0,i.jb)(r.Label,O),2),c=l[0],u=l[1],p=_((0,i.jb)(r.Input,R),2),d=p[0],f=p[1],h=_((0,i.jb)(r.Description,k),2),b=h[0],m=h[1],y=_((0,i.jb)(r.RadioMarkInner,g),2),j=y[0],F=y[1],P=_((0,i.jb)(r.RadioMarkOuter,w),2),$=P[0],S=P[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},x=o.createElement(c,z({},M,u),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return o.createElement(o.Fragment,null,o.createElement(a,z({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,s),("top"===(e=this.props.labelPlacement)||"left"===e)&&x,o.createElement($,z({},M,S),o.createElement(j,z({},M,F))),o.createElement(d,z({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:Z,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&x),!!this.props.description&&o.createElement(b,z({},M,m),this.props.description))}}])&&N(t.prototype,r),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);K(J,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:o.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const Q=J;var X=r(86964),Y=r(8429),ee=r(54840),te=r(96266);class re extends o.PureComponent{constructor(...e){super(...e),this.state={value:this.props.value},this.onChange=e=>{const t=parseInt(e.target.value,10);this.setState({value:t},(()=>this.props.onChange(t)))}}componentDidUpdate(e){e.value!==this.props.value&&this.props.value!==this.state.value&&this.setState(((e,t)=>({value:t.value})))}render(){const{theme:e,width:t,help:r,label:o,horizontal:n,labelVisibility:i}=this.props;let{disabled:a}=this.props;const{colors:s,radii:l}=e,c={width:t},u=[...this.props.options];return 0===u.length&&(u.push("No options to select."),a=!0),(0,te.jsxs)("div",{className:"row-widget stRadio",style:c,children:[(0,te.jsx)(X.ON,{label:o,disabled:a,labelVisibility:i,children:r&&(0,te.jsx)(X.Hp,{children:(0,te.jsx)(Y.ZP,{content:r,placement:ee.ug.TOP_RIGHT})})}),(0,te.jsx)(B,{onChange:this.onChange,value:this.state.value.toString(),disabled:a,align:n?V:D,"aria-label":o,children:u.map(((e,t)=>(0,te.jsx)(Q,{value:t.toString(),overrides:{Root:{style:({$isFocusVisible:e})=>({marginBottom:0,marginTop:0,marginRight:"1rem",paddingLeft:0,alignItems:"start",paddingRight:"2px",backgroundColor:e?s.darkenedBgMix25:"",borderTopLeftRadius:l.md,borderTopRightRadius:l.md,borderBottomLeftRadius:l.md,borderBottomRightRadius:l.md})},RadioMarkOuter:{style:({$checked:e})=>({width:"1rem",height:"1rem",marginTop:"0.35rem",marginRight:"0",backgroundColor:e&&!a?s.primary:s.fadedText40})},RadioMarkInner:{style:({$checked:e})=>({height:e?"6px":".75rem",width:e?"6px":".75rem"})},Label:{style:{color:a?s.fadedText40:s.bodyText,position:"relative",top:"1px"}}},children:e},t)))})]})}}const oe=(0,n.b)(re);var ne=r(56846),ie=r(34422);class ae extends o.PureComponent{constructor(...e){super(...e),this.formClearHelper=new ne.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setIntValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.setState({value:e},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getIntValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){const{disabled:e,element:t,width:r,widgetMgr:o}=this.props,{horizontal:n,options:i,label:a,labelVisibility:s,help:l}=t;return this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared),(0,te.jsx)(oe,{label:a,onChange:this.onChange,options:i,width:r,disabled:e,horizontal:n,labelVisibility:(0,ie.iF)(null===s||void 0===s?void 0:s.value),value:this.state.value,help:l})}}const se=ae}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7698],{67698:(e,t,s)=>{s.r(t),s.d(t,{default:()=>m});var o=s(5057),n=s(31476),i=s(99362),r=s(46540),l=s(63),a=s(45490),c=s(70765),g=s(69194);const d=(0,a.Z)(c.Q,{shouldForwardProp:g.Z,target:"e17lx80j1"})((({theme:e,$usingCustomTheme:t})=>({marginTop:e.spacing.none,marginBottom:e.spacing.none,marginRight:e.spacing.none,marginLeft:e.spacing.none,borderColor:e.colors.fadedText10,borderTopColor:t?e.colors.primary:e.colors.blue70,flexGrow:0,flexShrink:0})),""),h=(0,a.Z)("div",{target:"e17lx80j0"})((({theme:e})=>({display:"flex",gap:e.spacing.lg,alignItems:"center",width:"100%"})),"");var p=s(96266);const m=function({width:e,element:t}){const s=(0,n.u)(),{activeTheme:a}=o.useContext(l.I),c=!(0,i.MJ)(a),g={width:e};return(0,p.jsx)("div",{className:"stSpinner",style:g,children:(0,p.jsxs)(h,{children:[(0,p.jsx)(d,{$size:s.iconSizes.twoXL,$usingCustomTheme:c}),(0,p.jsx)(r.Z,{source:t.text,allowHTML:!1})]})})}}}]);
@@ -0,0 +1,5 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7858],{6757:(e,t,i)=>{i.d(t,{Z:()=>d});i(5057);var s=i(34422),o=i(86964),r=i(45490);const n=i(21371).F4`
2
+ 50% {
3
+ color: rgba(0, 0, 0, 0);
4
+ }
5
+ `,a=(0,r.Z)("span",{target:"e1m4n6jn0"})((({includeDot:e,shouldBlink:t,theme:i})=>({...e?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:i.colors.gray,margin:"0 5px"}}:{},...t?{color:i.colors.red,animationName:`${n}`,animationDuration:"0.5s",animationIterationCount:5}:{}})),"");var l=i(96266);const d=({dirty:e,value:t,maxLength:i,className:r,type:n="single"})=>{const d=[],h=(e,t=!1)=>{d.push((0,l.jsx)(a,{includeDot:d.length>0,shouldBlink:t,children:e},d.length))};return e&&("multiline"===n?(0,s.Ge)()?h("Press \u2318+Enter to apply"):h("Press Ctrl+Enter to apply"):h("Press Enter to apply")),i&&h(`${t.length}/${i}`,e&&t.length>=i),(0,l.jsx)(o.X7,{className:r,children:d})}},7858:(e,t,i)=>{i.r(t),i.d(t,{default:()=>D});var s=i(5057),o=i(52707),r=i(84332),n=i(59500),a=i(56846),l=i(52801),d=i(32291),h=i(8429),c=i(54840),u=i(97292),m=i(30124),p=i(6757),g=i(86964),b=i(34422),f=i(45490);const y=(0,f.Z)("div",{target:"e1jwn65y3"})((({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",borderWidth:"1px",borderStyle:"solid",borderColor:e.colors.widgetBorderColor||e.colors.widgetBackgroundColor||e.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.md,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}})),""),x=(0,f.Z)("div",{target:"e1jwn65y2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),v=(0,f.Z)("button",{target:"e1jwn65y1"})((({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:"32px",justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.widgetBackgroundColor||e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}})),""),w=(0,f.Z)("div",{target:"e1jwn65y0"})((({theme:e})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:"64px"})),"");var V=i(96266);class C extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new a.Kz,this.inputRef=s.createRef(),this.formatValue=e=>{const t=function(e){return null==e||""===e?void 0:e}(this.props.element.format);if(null==t)return e.toString();try{return(0,n.sprintf)(t,e)}catch(i){return(0,l.KE)(`Error in sprintf(${t}, ${e}): ${i}`),String(e)}},this.isIntData=()=>this.props.element.dataType===d.Y2.DataType.INT,this.getMin=()=>this.props.element.hasMin?this.props.element.min:-1/0,this.getMax=()=>this.props.element.hasMax?this.props.element.max:1/0,this.getStep=()=>{const{step:e}=this.props.element;return e||(this.isIntData()?1:.01)},this.commitWidgetValue=e=>{const{value:t}=this.state,{element:i,widgetMgr:s}=this.props,o=this.props.element,r=this.getMin(),n=this.getMax();if(r>t||t>n){const e=this.inputRef.current;e&&e.reportValidity()}else{const r=t||0===t?t:o.default;this.isIntData()?s.setIntValue(i,r,e):s.setDoubleValue(i,r,e),this.setState({dirty:!1,value:r,formattedValue:this.formatValue(r)})}},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0}),this.setState({isFocused:!1})},this.onFocus=()=>{this.setState({isFocused:!0})},this.onChange=e=>{const{value:t}=e.target;let i;i=this.isIntData()?parseInt(t,10):parseFloat(t),this.setState({dirty:!0,value:i,formattedValue:t})},this.onKeyDown=e=>{const{key:t}=e;switch(t){case"ArrowUp":e.preventDefault(),this.modifyValueUsingStep("increment")();break;case"ArrowDown":e.preventDefault(),this.modifyValueUsingStep("decrement")()}},this.onKeyPress=e=>{"Enter"===e.key&&this.state.dirty&&this.commitWidgetValue({fromUi:!0})},this.modifyValueUsingStep=e=>()=>{const{value:t}=this.state,i=this.getStep();switch(e){case"increment":this.canIncrement&&this.setState({dirty:!0,value:t+i},(()=>{this.commitWidgetValue({fromUi:!0})}));break;case"decrement":this.canDecrement&&this.setState({dirty:!0,value:t-i},(()=>{this.commitWidgetValue({fromUi:!0})}))}},this.state={dirty:!1,value:this.initialValue,formattedValue:this.formatValue(this.initialValue),isFocused:!1}}get initialValue(){const e=this.isIntData()?this.props.widgetMgr.getIntValue(this.props.element):this.props.widgetMgr.getDoubleValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e,formattedValue:this.formatValue(e)},(()=>{this.commitWidgetValue({fromUi:!1})}))}get canDecrement(){return this.state.value-this.getStep()>=this.getMin()}get canIncrement(){return this.state.value+this.getStep()<=this.getMax()}render(){var e;const{element:t,width:i,disabled:s,widgetMgr:n}=this.props,{formattedValue:a,dirty:l,isFocused:d}=this.state,f={width:i},C=!this.canDecrement||s,D=!this.canIncrement||s;return this.formClearHelper.manageFormClearListener(n,t.formId,this.onFormCleared),(0,V.jsxs)("div",{className:"stNumberInput",style:f,children:[(0,V.jsx)(g.ON,{label:t.label,disabled:s,labelVisibility:(0,b.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,V.jsx)(g.dT,{children:(0,V.jsx)(h.ZP,{content:t.help,placement:c.ug.TOP_RIGHT})})}),(0,V.jsxs)(y,{className:d?"focused":"",children:[(0,V.jsx)(m.Z,{type:"number",inputRef:this.inputRef,value:a,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,disabled:s,"aria-label":t.label,overrides:{Input:{props:{step:this.getStep(),min:this.getMin(),max:this.getMax()},style:{lineHeight:"1.4",paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0})}}}),(0,V.jsxs)(x,{children:[(0,V.jsx)(v,{className:"step-down",onClick:this.modifyValueUsingStep("decrement"),disabled:C,children:(0,V.jsx)(u.ZP,{content:o.W,size:"xs",color:this.canDecrement?"inherit":"disabled"})}),(0,V.jsx)(v,{className:"step-up",onClick:this.modifyValueUsingStep("increment"),disabled:D,children:(0,V.jsx)(u.ZP,{content:r.v,size:"xs",color:this.canIncrement?"inherit":"disabled"})})]})]}),(0,V.jsx)(w,{children:(0,V.jsx)(p.Z,{dirty:l,value:a,className:"input-instructions"})})]})}}const D=C}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7937],{47937:(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});i(5057);var s=i(92445),l=i(46540),d=i(96266);const n=function(e){const{disabled:t,element:i,widgetMgr:n,width:r}=e,h={width:r},a="primary"===i.type?s.hY.PRIMARY:s.hY.SECONDARY;return(0,d.jsx)("div",{className:"row-widget stButton",style:h,children:(0,d.jsx)(s.uD,{help:i.help,children:(0,d.jsx)(s.ZP,{kind:a,size:s.$u.SMALL,disabled:t,fluidWidth:i.useContainerWidth||!1,onClick:()=>n.setTriggerValue(i,{fromUi:!0}),children:(0,d.jsx)(l.Z,{source:i.label,allowHTML:!1,isButton:!0})})})})}}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7937],{47937:(e,t,i)=>{i.r(t),i.d(t,{default:()=>n});i(5057);var s=i(92445),l=i(46540),d=i(96266);const n=function(e){const{disabled:t,element:i,widgetMgr:n,width:r}=e,a={width:r},h="primary"===i.type?s.hY.PRIMARY:s.hY.SECONDARY;return(0,d.jsx)("div",{className:"row-widget stButton",style:a,children:(0,d.jsx)(s.uD,{help:i.help,children:(0,d.jsx)(s.ZP,{kind:h,size:s.$u.SMALL,disabled:t,fluidWidth:i.useContainerWidth||!1,onClick:()=>n.setTriggerValue(i,{fromUi:!0}),children:(0,d.jsx)(l.Z,{source:i.label,allowHTML:!1,isLabel:!0,isButton:!0})})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8355],{78355:(e,t,i)=>{i.r(t),i.d(t,{default:()=>m});var s=i(5057),o=i(61839),r=i(56846),a=i(86964),l=i(8429),n=i(54840),d=i(34422),p=i(96266);class h extends s.PureComponent{constructor(...e){super(...e),this.formClearHelper=new r.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let t;t=null===e?this.initialValue:this.dateToString(e),this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))},this.stringToDate=e=>{const[t,i]=e.split(":").map(Number),s=new Date;return s.setHours(t),s.setMinutes(i),s},this.dateToString=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}get initialValue(){const e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{disabled:t,width:i,element:s,widgetMgr:r}=this.props,h={width:i},m={Select:{props:{disabled:t,overrides:{ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},IconsContainer:{style:()=>({paddingRight:".5rem"})},ValueContainer:{style:()=>({paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"})},Dropdown:{style:()=>({paddingTop:0,paddingBottom:0})},Popover:{props:{overrides:{Body:{style:()=>({marginTop:"1px"})}}}}}}}};return this.formClearHelper.manageFormClearListener(r,s.formId,this.onFormCleared),(0,p.jsxs)("div",{className:"stTimeInput",style:h,children:[(0,p.jsx)(a.ON,{label:s.label,disabled:t,labelVisibility:(0,d.iF)(null===(e=s.labelVisibility)||void 0===e?void 0:e.value),children:s.help&&(0,p.jsx)(a.dT,{children:(0,p.jsx)(l.Z,{content:s.help,placement:n.ug.TOP_RIGHT})})}),(0,p.jsx)(o.Z,{format:"24",value:this.stringToDate(this.state.value),onChange:this.handleChange,overrides:m,creatable:!0,"aria-label":s.label})]})}}const m=h}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8355],{78355:(e,t,i)=>{i.r(t),i.d(t,{default:()=>h});var s=i(5057),o=i(61839),r=i(56846),a=i(86964),l=i(8429),n=i(54840),d=i(34422),p=i(96266);class m extends s.PureComponent{constructor(...e){super(...e),this.formClearHelper=new r.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let t;t=null===e?this.initialValue:this.dateToString(e),this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))},this.stringToDate=e=>{const[t,i]=e.split(":").map(Number),s=new Date;return s.setHours(t),s.setMinutes(i),s},this.dateToString=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}get initialValue(){const e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{disabled:t,width:i,element:s,widgetMgr:r}=this.props,m={width:i},h={Select:{props:{disabled:t,overrides:{ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},IconsContainer:{style:()=>({paddingRight:".5rem"})},ValueContainer:{style:()=>({paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"})},SingleValue:{props:{className:"stTimeInput-timeDisplay"}},Dropdown:{style:()=>({paddingTop:0,paddingBottom:0})},Popover:{props:{overrides:{Body:{style:()=>({marginTop:"1px"})}}}}}}}};return this.formClearHelper.manageFormClearListener(r,s.formId,this.onFormCleared),(0,p.jsxs)("div",{className:"stTimeInput",style:m,children:[(0,p.jsx)(a.ON,{label:s.label,disabled:t,labelVisibility:(0,d.iF)(null===(e=s.labelVisibility)||void 0===e?void 0:e.value),children:s.help&&(0,p.jsx)(a.dT,{children:(0,p.jsx)(l.ZP,{content:s.help,placement:n.ug.TOP_RIGHT})})}),(0,p.jsx)(o.Z,{format:"24",step:s.step?Number(s.step):900,value:this.stringToDate(this.state.value),onChange:this.handleChange,overrides:h,creatable:!0,"aria-label":s.label})]})}}const h=m}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8461],{88461:(t,e,o)=>{o.r(e),o.d(e,{default:()=>F});var i=o(5057),n=o(31476),a=o(86928),s=o(12808),r=o(79220),l=o(52801),d=o(62658),c=o(47143),h=o(89163),g=o(65873),u=o(99362);function m(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,u.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,u.ny)(e),domain:!1,domainWidth:1,domainColor:(0,u.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,u.Xy)(e),titlePadding:e.spacing.mdPx,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,u.iY)(e),diverging:(0,u.ru)(e),ramp:(0,u.Gy)(e),heatmap:(0,u.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,u.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?(0,g.mergeWith)({},o,t,((t,e)=>(0,g.isArray)(e)?e:void 0)):o}const p=(0,o(45490).Z)("div",{target:"everg990"})((({theme:t})=>({"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:t.zIndices.popupMenu,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`1px solid ${t.colors.fadedText10}`,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText},"a:hover":{backgroundColor:t.colors.secondaryBg,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.md,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix25}}}})),"");var f=o(96266);const b={DATAFRAME_INDEX:"(index)"},w="source",y=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class v extends i.PureComponent{constructor(...t){super(...t),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=w,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t,e;const{element:o,theme:i}=this.props,n=JSON.parse(o.spec),{useContainerWidth:a}=o;if("streamlit"===o.vegaLiteTheme?n.config=m(n.config,i):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(n.config=m(n.config,i),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:i,genericFonts:n}=e,a={labelFont:n.bodyFont,titleFont:n.bodyFont,labelFontSize:i.twoSmPx,titleFontSize:i.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,u.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText},view:{continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?(0,g.merge)({},s,t):s}(n.config,i),this.props.height?(n.width=this.props.width,n.height=this.props.height):a&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:i,theme:n}=this.props,a=e.spec,{spec:s}=i;if(!this.vegaView||a!==s||o!==n||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=i;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=x(e)||{},g=x(i)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,S(o));const{dataRows:i,dataColumns:n}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,i,n,a){if(o!==a)return!1;if(e>=n)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==i.getDataValue(0,s)||t.getDataValue(r,s)!==i.getDataValue(r,s))return!1;return!0}(e,i,n,o,a,r))i<a&&this.vegaView.insert(t,S(o,i));else{const e=s.changeset().remove(s.truthy).insert(S(o));this.vegaView.change(t,e),(0,l.ji)(`Had to clear the ${t} dataset before inserting data through Vega view.`)}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={defaultStyle:!0,ast:!0,expr:r.N},{vgSpec:i,view:n,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=n,this.vegaFinalizer=s;const d=function(t){const e=x(t);if(null==e)return null;const o={};for(const[i,n]of Object.entries(e))o[i]=S(n);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&i.data&&(this.defaultDataName=w);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return S(e)}(t);if(h&&n.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))n.insert(a,r);await n.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,f.jsx)(p,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function x(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function S(t,e=0){if(t.isEmpty())return[];const o=[],{dataRows:i,dataColumns:n}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=y.has(a);for(let r=e;r<i;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[b.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<n;o++){const i=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof i?Number(i):i}o.push(e)}return o}const F=(0,n.b)((0,d.Z)(v))}}]);
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8461],{88461:(t,e,o)=>{o.r(e),o.d(e,{default:()=>F});var i=o(5057),n=o(31476),a=o(96223),s=o(96533),r=o(79220),l=o(52801),d=o(62658),c=o(47143),h=o(89163),g=o(65873),u=o(99362);function m(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,u.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,u.ny)(e),domain:!1,domainWidth:1,domainColor:(0,u.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,u.Xy)(e),titlePadding:e.spacing.mdPx,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,u.iY)(e),diverging:(0,u.ru)(e),ramp:(0,u.Gy)(e),heatmap:(0,u.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,u.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?(0,g.mergeWith)({},o,t,((t,e)=>(0,g.isArray)(e)?e:void 0)):o}const p=(0,o(45490).Z)("div",{target:"everg990"})((({theme:t})=>({"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:t.zIndices.popupMenu,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`1px solid ${t.colors.fadedText10}`,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText},"a:hover":{backgroundColor:t.colors.secondaryBg,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.md,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix25}}}})),"");var f=o(96266);const b={DATAFRAME_INDEX:"(index)"},w="source",y=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class v extends i.PureComponent{constructor(...t){super(...t),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=w,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t,e;const{element:o,theme:i}=this.props,n=JSON.parse(o.spec),{useContainerWidth:a}=o;if("streamlit"===o.vegaLiteTheme?n.config=m(n.config,i):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(n.config=m(n.config,i),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:i,genericFonts:n}=e,a={labelFont:n.bodyFont,titleFont:n.bodyFont,labelFontSize:i.twoSmPx,titleFontSize:i.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,u.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText},view:{continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?(0,g.merge)({},s,t):s}(n.config,i),this.props.height?(n.width=this.props.width,n.height=this.props.height):a&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:i,theme:n}=this.props,a=e.spec,{spec:s}=i;if(!this.vegaView||a!==s||o!==n||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=i;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=x(e)||{},g=x(i)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,S(o));const{dataRows:i,dataColumns:n}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,i,n,a){if(o!==a)return!1;if(e>=n)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==i.getDataValue(0,s)||t.getDataValue(r,s)!==i.getDataValue(r,s))return!1;return!0}(e,i,n,o,a,r))i<a&&this.vegaView.insert(t,S(o,i));else{const e=s.changeset().remove(s.truthy).insert(S(o));this.vegaView.change(t,e),(0,l.ji)(`Had to clear the ${t} dataset before inserting data through Vega view.`)}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={defaultStyle:!0,ast:!0,expr:r.N},{vgSpec:i,view:n,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=n,this.vegaFinalizer=s;const d=function(t){const e=x(t);if(null==e)return null;const o={};for(const[i,n]of Object.entries(e))o[i]=S(n);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&i.data&&(this.defaultDataName=w);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return S(e)}(t);if(h&&n.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))n.insert(a,r);await n.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,f.jsx)(p,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function x(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function S(t,e=0){if(t.isEmpty())return[];const o=[],{dataRows:i,dataColumns:n}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=y.has(a);for(let r=e;r<i;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[b.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<n;o++){const i=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof i?Number(i):i}o.push(e)}return o}const F=(0,n.b)((0,d.Z)(v))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9462],{69462:(e,t,s)=>{s.r(t),s.d(t,{default:()=>l});var i=s(5057),u=s(35e3),r=s(96266);function l({element:e,width:t,endpoints:s}){const l=(0,i.useRef)(null);(0,i.useEffect)((()=>{l.current&&(l.current.currentTime=e.startTime)}),[e.startTime]);const n=(0,u.O0)(e.url),a=s.buildMediaURL(n);return(0,r.jsx)("audio",{id:"audio",ref:l,controls:!0,src:a,className:"stAudio",style:{width:t}})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9551],{29551:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var s=r(5057),a=r(32291),n=r(35e3),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}})}}}]);