streamlit-nightly 1.21.1.dev20230423__py2.py3-none-any.whl → 1.21.1.dev20230425__py2.py3-none-any.whl

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 (40) hide show
  1. streamlit/__init__.py +0 -7
  2. streamlit/elements/arrow.py +7 -264
  3. streamlit/elements/data_editor.py +109 -100
  4. streamlit/elements/file_uploader.py +17 -0
  5. streamlit/elements/layouts.py +0 -5
  6. streamlit/elements/lib/column_config_utils.py +371 -0
  7. streamlit/elements/lib/pandas_styler_utils.py +275 -0
  8. streamlit/runtime/connection_factory.py +5 -5
  9. streamlit/static/asset-manifest.json +20 -20
  10. streamlit/static/index.html +1 -1
  11. streamlit/static/static/js/{14.a19a6cd8.chunk.js → 14.9399e424.chunk.js} +1 -1
  12. streamlit/static/static/js/{227.087adf66.chunk.js → 227.9ccac1d5.chunk.js} +1 -1
  13. streamlit/static/static/js/{242.0daf8b47.chunk.js → 242.1b3289e0.chunk.js} +1 -1
  14. streamlit/static/static/js/{279.fdac58fc.chunk.js → 279.35b01780.chunk.js} +1 -1
  15. streamlit/static/static/js/{289.481fd42d.chunk.js → 289.e6157e40.chunk.js} +1 -1
  16. streamlit/static/static/js/{467.242e14ff.chunk.js → 467.50ac84df.chunk.js} +1 -1
  17. streamlit/static/static/js/{491.d0b710e9.chunk.js → 491.5a33a8ce.chunk.js} +1 -1
  18. streamlit/static/static/js/503.15864587.chunk.js +1 -0
  19. streamlit/static/static/js/{511.9f04ae9e.chunk.js → 511.e6ca580f.chunk.js} +1 -1
  20. streamlit/static/static/js/{578.ceaadcd5.chunk.js → 578.a65fcea0.chunk.js} +1 -1
  21. streamlit/static/static/js/{619.365611c8.chunk.js → 619.0325af0e.chunk.js} +1 -1
  22. streamlit/static/static/js/{628.7f41e2de.chunk.js → 628.9c70196b.chunk.js} +1 -1
  23. streamlit/static/static/js/{681.a2ba76c7.chunk.js → 681.9e30a8cd.chunk.js} +1 -1
  24. streamlit/static/static/js/{745.e2bcf16d.chunk.js → 745.e75ba963.chunk.js} +1 -1
  25. streamlit/static/static/js/{807.6789990f.chunk.js → 807.122f8b05.chunk.js} +1 -1
  26. streamlit/static/static/js/{828.096c1ad3.chunk.js → 828.0fde3da8.chunk.js} +1 -1
  27. streamlit/static/static/js/{871.ba625aee.chunk.js → 871.90a7dbae.chunk.js} +1 -1
  28. streamlit/static/static/js/{main.5e4731c6.js → main.ff35bd72.js} +2 -2
  29. streamlit/testing/element_tree.py +426 -548
  30. streamlit/type_util.py +19 -7
  31. {streamlit_nightly-1.21.1.dev20230423.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/METADATA +1 -1
  32. {streamlit_nightly-1.21.1.dev20230423.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/RECORD +38 -37
  33. streamlit/elements/show.py +0 -105
  34. streamlit/static/static/js/728.82770810.chunk.js +0 -1
  35. /streamlit/static/static/css/{728.23fa976d.chunk.css → 503.23fa976d.chunk.css} +0 -0
  36. /streamlit/static/static/js/{main.5e4731c6.js.LICENSE.txt → main.ff35bd72.js.LICENSE.txt} +0 -0
  37. {streamlit_nightly-1.21.1.dev20230423.data → streamlit_nightly-1.21.1.dev20230425.data}/scripts/streamlit.cmd +0 -0
  38. {streamlit_nightly-1.21.1.dev20230423.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/WHEEL +0 -0
  39. {streamlit_nightly-1.21.1.dev20230423.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/entry_points.txt +0 -0
  40. {streamlit_nightly-1.21.1.dev20230423.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[511],{4371:function(e,t,n){n.d(t,{$:function(){return i},Z:function(){return c}});var i,r=n(47313),a=n(83985),s=n(54922),o=n(16168),l=n(75314),d=n(74969),u=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(i||(i={}));var c=function(e){var t=e.value,n=e.width,c=e.size,g=void 0===c?i.SMALL:c,p=e.overrides,f=(0,a.u)(),m={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},h=r.useContext(s.I).activeTheme,v=!(0,o.MJ)(h),x={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:m[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,u.jsx)(l.Z,{value:t,overrides:(0,d.aO)(x,p)})}},84677:function(e,t,n){n.d(t,{R:function(){return a}});var i=n(15671),r=n(43144),a=function(){function e(t,n,r,a){(0,i.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=r,this.status=a}return(0,r.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()},41511:function(e,t,n){n.r(t),n.d(t,{default:function(){return ye}});var i,r=n(93433),a=n(15671),s=n(43144),o=n(60136),l=n(29388),d=n(31881),u=n.n(d),c=n(16031),g=n.n(c),p=n(47313),f=n(7976),m=n(46332),h=n(64243);!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(i||(i={}));var v=(0,h.rA)()?1024:1e3,x=[i.Gigabyte,i.Megabyte,i.Kilobyte,i.Byte],y=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n||(n=i.Byte),r<0&&(r=0),t<0)throw new Error("Size must be greater than or equal to 0");var a=x.indexOf(n),s=t/v;return a&&t>v/2?e(s,x[a-1],r):"".concat(t.toFixed(r)).concat(n.toUpperCase())},S=n(65167),w=n(73290),b=n(80213),F=n(1413),Z=n(80614),j=n(69367),I=n(4942),z=n(47167);var M=(0,z.Z)("section",{target:"exg6vvm15"})((function(e){var t=e.isDisabled,n=e.theme;return{display:"flex",alignItems:"center",padding:n.spacing.lg,backgroundColor:n.colors.secondaryBg,borderRadius:n.radii.md,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(n.colors.primary)},color:t?n.colors.gray:n.colors.bodyText}}),""),B=(0,z.Z)("div",{target:"exg6vvm14"})((function(){return{marginRight:"auto",alignItems:"center",display:"flex"}}),""),k=(0,z.Z)("span",{target:"exg6vvm13"})((function(e){var t=e.theme;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),L=(0,z.Z)("span",{target:"exg6vvm12"})((function(e){return{marginBottom:e.theme.spacing.twoXS}}),""),R=(0,z.Z)("div",{target:"exg6vvm11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),C=(0,z.Z)("div",{target:"exg6vvm10"})((function(e){var t=e.theme;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),U=(0,z.Z)("ul",{target:"exg6vvm9"})((function(){return{listStyleType:"none",marginBottom:0}}),""),P=(0,z.Z)("li",{target:"exg6vvm8"})((function(e){var t=e.theme;return{margin:t.spacing.none,padding:t.spacing.none}}),""),T=(0,z.Z)("div",{target:"exg6vvm7"})((function(e){return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.theme.spacing.lg,overflow:"hidden"}}),""),X=(0,z.Z)("div",{target:"exg6vvm6"})((function(e){var t=e.theme;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),A=(0,z.Z)("div",{target:"exg6vvm5"})((function(e){return{display:"flex",alignItems:"center",marginBottom:e.theme.spacing.twoXS}}),""),D=(0,z.Z)("span",{target:"exg6vvm4"})((function(e){return{marginRight:e.theme.spacing.twoXS}}),""),E=(0,z.Z)("div",{target:"exg6vvm3"})((function(e){var t=e.theme;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),N=(0,z.Z)("small",{target:"exg6vvm2"})((function(e){var t=e.theme;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),O=(0,z.Z)("span",{target:"exg6vvm1"})({name:"0",styles:""}),V=function(e){var t;return t={},(0,I.Z)(t,M,{display:"flex",flexDirection:"column",alignItems:"flex-start"}),(0,I.Z)(t,B,{marginBottom:e.spacing.lg}),(0,I.Z)(t,k,{display:"none"}),(0,I.Z)(t,C,{paddingRight:e.spacing.lg}),(0,I.Z)(t,A,{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm}),(0,I.Z)(t,X,{width:e.sizes.full}),(0,I.Z)(t,T,{flexDirection:"column"}),(0,I.Z)(t,N,{height:"auto",whiteSpace:"initial"}),(0,I.Z)(t,O,{display:"none"}),(0,I.Z)(t,P,{margin:e.spacing.none,padding:e.spacing.none}),t},H=(0,z.Z)("div",{target:"exg6vvm0"})((function(e){var t=e.theme;return t.inSidebar?V(t):(0,I.Z)({},"@media (max-width: ".concat(t.breakpoints.sm,")"),V(t))}),""),G=n(66071),W=n(49089),Y=n(49986),q=n(46417),$=function(e){var t=e.multiple,n=e.acceptedExtensions,r=e.maxSizeBytes;return(0,q.jsxs)(B,{children:[(0,q.jsx)(k,{children:(0,q.jsx)(W.ZP,{content:G.n,size:"threeXL"})}),(0,q.jsxs)(R,{children:[(0,q.jsxs)(L,{children:["Drag and drop file",t?"s":""," here"]}),(0,q.jsxs)(Y.x,{children:["Limit ".concat(y(r,i.Byte,0)," per file"),n.length?" \u2022 ".concat(n.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},_=function(e){var t=e.onDrop,n=e.multiple,i=e.acceptedExtensions,r=e.maxSizeBytes,a=e.disabled,s=e.label;return(0,q.jsx)(Z.ZP,{onDrop:t,multiple:n,accept:i.length?i:void 0,maxSize:r,disabled:a,useFsAccessApi:!1,children:function(e){var t=e.getRootProps,o=e.getInputProps;return(0,q.jsxs)(M,(0,F.Z)((0,F.Z)({},t()),{},{"data-testid":"stFileUploadDropzone",isDisabled:a,"aria-label":s,children:[(0,q.jsx)("input",(0,F.Z)({},o())),(0,q.jsx)($,{multiple:n,acceptedExtensions:i,maxSizeBytes:r}),(0,q.jsx)(j.ZP,{kind:j.hY.SECONDARY,disabled:a,size:j.$u.SMALL,children:"Browse files"})]}))}})},K=n(29439),J=n(45987),Q=n(67861),ee=n.n(Q),te=n(71054),ne=n(87669),ie=(0,z.Z)("div",{target:"e1f8s2qs1"})((function(e){var t=e.theme;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),re=(0,z.Z)("div",{target:"e1f8s2qs0"})((function(e){return{display:"flex",alignItems:"center",justifyContent:"center",color:e.theme.colors.fadedText40}}),""),ae=function(e){var t=e.className,n=e.currentPage,i=e.totalPages,r=e.onNext,a=e.onPrevious;return(0,q.jsxs)(ie,{className:t,children:[(0,q.jsx)(Y.x,{children:"Showing page ".concat(n," of ").concat(i)}),(0,q.jsxs)(re,{children:[(0,q.jsx)(j.ZP,{onClick:a,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:te.s,size:"xl"})}),(0,q.jsx)(j.ZP,{onClick:r,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ne._,size:"xl"})})]})]})},se=n(74424),oe=["pageSize","items","resetOnAdd"],le=function(e,t){return Math.ceil(e.length/t)},de=function(e){return ee()((function(t){var n=t.pageSize,i=t.items,r=t.resetOnAdd,a=(0,J.Z)(t,oe),s=(0,p.useState)(0),o=(0,K.Z)(s,2),l=o[0],d=o[1],u=(0,p.useState)(le(i,n)),c=(0,K.Z)(u,2),g=c[0],f=c[1],m=(0,se.D)(i);(0,p.useEffect)((function(){m&&m.length!==i.length&&f(le(i,n)),m&&m.length<i.length?r&&d(0):l+1>=g&&d(g-1)}),[i,l,n,m,r,g]);var h=i.slice(l*n,l*n+n);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(e,(0,F.Z)({items:h},a)),i.length>n?(0,q.jsx)(ae,{className:"streamlit-paginator",pageSize:n,totalPages:g,currentPage:l+1,onNext:function(){d(Math.min(l+1,g-1))},onPrevious:function(){d(Math.max(0,l-1))}}):null]})}),e)},ue=n(2029),ce=n(70782),ge=n(98664),pe=n(4371),fe=function(e){var t=e.fileInfo;return"uploading"===t.status.type?(0,q.jsx)(pe.Z,{value:t.status.progress,size:pe.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,q.jsxs)(N,{children:[(0,q.jsx)(D,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,q.jsx)(O,{children:(0,q.jsx)(W.ZP,{content:ue.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,q.jsx)(Y.x,{children:y(t.size,i.Byte)}):null},me=function(e){var t=e.fileInfo,n=e.onDelete;return(0,q.jsxs)(A,{className:"uploadedFile",children:[(0,q.jsx)(E,{children:(0,q.jsx)(W.ZP,{content:ce.h,size:"twoXL"})}),(0,q.jsxs)(T,{className:"uploadedFileData",children:[(0,q.jsx)(X,{className:"uploadedFileName",title:t.name,children:t.name}),(0,q.jsx)(fe,{fileInfo:t})]}),(0,q.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,q.jsx)(j.ZP,{onClick:function(){return n(t.id)},kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ge.U,size:"lg"})})})]})},he=de((function(e){var t=e.items,n=e.onDelete;return(0,q.jsx)(U,{children:t.map((function(e){return(0,q.jsx)(P,{children:(0,q.jsx)(me,{fileInfo:e,onDelete:n})},e.id)}))})})),ve=function(e){return(0,q.jsx)(C,{children:(0,q.jsx)(he,(0,F.Z)({},e))})},xe=n(84677),ye=function(e){(0,o.Z)(n,e);var t=(0,l.Z)(n);function n(e){var s;return(0,a.Z)(this,n),(s=t.call(this,e)).formClearHelper=new m.Kz,s.localFileIdCounter=1,s.componentDidUpdate=function(e){var t=s.props,n=t.element,i=t.widgetMgr;if(e.disabled!==s.props.disabled&&s.props.disabled)return s.reset(),void i.setFileUploaderStateValue(n,new f.xO,{fromUi:!1});if("ready"===s.status){var r=s.createWidgetValue();if(void 0!==r){var a=i.getFileUploaderStateValue(n);g().isEqual(r,a)||i.setFileUploaderStateValue(n,r,{fromUi:!0})}}},s.reset=function(){s.setState({files:[]})},s.dropHandler=function(e,t){var n=s.props.element.multipleFiles;if(!n&&0===e.length&&t.length>1){var i=t.findIndex((function(e){return 1===e.errors.length&&"too-many-files"===e.errors[0].code}));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(!n&&e.length>0&&s.state.files.length>0&&s.removeFile(s.state.files[0].id),e.forEach(s.uploadFile),t.length>0){var r=t.map((function(e){var t=e.file;return new xe.R(t.name,t.size,s.nextLocalFileId(),{type:"error",errorMessage:s.getErrorMessage(e.errors[0].code,e.file)})}));s.addFiles(r)}},s.uploadFile=function(e){var t=u().CancelToken.source(),n=new xe.R(e.name,e.size,s.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});s.addFile(n),s.props.uploadClient.uploadFile(s.props.element,e,(function(e){return s.onUploadProgress(e,n.id)}),t.token).then((function(e){return s.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||s.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},s.onUploadComplete=function(e,t){s.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t)}}));var n=s.getFile(e);null!=n&&"uploading"===n.status.type&&s.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},s.getErrorMessage=function(e,t){switch(e){case"file-too-large":return"File must be ".concat(y(s.maxUploadSizeInBytes,i.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},s.deleteFile=function(e){var t=s.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),s.removeFile(e))},s.addFile=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),[e])}}))},s.addFiles=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),(0,r.Z)(e))}}))},s.removeFile=function(e){s.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},s.getFile=function(e){return s.state.files.find((function(t){return t.id===e}))},s.updateFile=function(e,t){s.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},s.onUploadProgress=function(e,t){var n=s.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&s.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},s.onFormCleared=function(){s.setState({files:[]},(function(){var e=s.createWidgetValue();null!=e&&s.props.widgetMgr.setFileUploaderStateValue(s.props.element,e,{fromUi:!0})}))},s.state=s.initialValue,s}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0},n=this.props,i=n.widgetMgr,r=n.element,a=i.getFileUploaderStateValue(r);if(null==a)return t;var s=a.maxFileId,o=a.uploadedFileInfo;return null==s||0===s||null==o?t:{files:o.map((function(t){var n=t.name,i=t.size,r=t.id;return new xe.R(n,i,e.nextLocalFileId(),{type:"uploaded",serverFileId:r})})),newestServerFileId:Number(s)}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maxUploadSizeInBytes",get:function(){return function(e,t,n){if(e<0)throw Error("Size must be 0 or greater");var i=x.findIndex((function(e){return e===t})),r=x.findIndex((function(e){return e===n}));if(-1===i||-1===r)throw Error("Unexpected byte unit provided");if(i===r)return e;var a=Math.abs(i-r),s=Math.pow(v,a);return i>r?e/s:e*s}(this.props.element.maxUploadSizeMb,i.Megabyte,i.Byte)}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,i=e.status;return new f.jM({id:i.serverFileId,name:t,size:n})}));return new f.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.state.files,n=this.props,i=n.element,r=n.disabled,a=n.widgetMgr,s=i.type;this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared);var o=t.slice().reverse();return(0,q.jsxs)(H,{"data-testid":"stFileUploader",children:[(0,q.jsx)(S.ON,{label:i.label,disabled:r,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,q.jsx)(S.dT,{children:(0,q.jsx)(w.ZP,{content:i.help,placement:b.ug.TOP_RIGHT})})}),(0,q.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:s,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:r}),o.length>0&&(0,q.jsx)(ve,{items:o,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(p.PureComponent)}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[511],{4371:function(e,t,n){n.d(t,{$:function(){return i},Z:function(){return c}});var i,r=n(47313),a=n(83985),s=n(54922),o=n(81512),l=n(75314),d=n(74969),u=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(i||(i={}));var c=function(e){var t=e.value,n=e.width,c=e.size,g=void 0===c?i.SMALL:c,p=e.overrides,f=(0,a.u)(),m={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},h=r.useContext(s.I).activeTheme,v=!(0,o.MJ)(h),x={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:m[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,u.jsx)(l.Z,{value:t,overrides:(0,d.aO)(x,p)})}},84677:function(e,t,n){n.d(t,{R:function(){return a}});var i=n(15671),r=n(43144),a=function(){function e(t,n,r,a){(0,i.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=r,this.status=a}return(0,r.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()},41511:function(e,t,n){n.r(t),n.d(t,{default:function(){return ye}});var i,r=n(93433),a=n(15671),s=n(43144),o=n(60136),l=n(29388),d=n(31881),u=n.n(d),c=n(16031),g=n.n(c),p=n(47313),f=n(7976),m=n(46332),h=n(64243);!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(i||(i={}));var v=(0,h.rA)()?1024:1e3,x=[i.Gigabyte,i.Megabyte,i.Kilobyte,i.Byte],y=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n||(n=i.Byte),r<0&&(r=0),t<0)throw new Error("Size must be greater than or equal to 0");var a=x.indexOf(n),s=t/v;return a&&t>v/2?e(s,x[a-1],r):"".concat(t.toFixed(r)).concat(n.toUpperCase())},S=n(65167),w=n(73290),b=n(10612),F=n(1413),Z=n(80614),j=n(69367),I=n(4942),z=n(47167);var M=(0,z.Z)("section",{target:"exg6vvm15"})((function(e){var t=e.isDisabled,n=e.theme;return{display:"flex",alignItems:"center",padding:n.spacing.lg,backgroundColor:n.colors.secondaryBg,borderRadius:n.radii.md,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(n.colors.primary)},color:t?n.colors.gray:n.colors.bodyText}}),""),B=(0,z.Z)("div",{target:"exg6vvm14"})((function(){return{marginRight:"auto",alignItems:"center",display:"flex"}}),""),k=(0,z.Z)("span",{target:"exg6vvm13"})((function(e){var t=e.theme;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),L=(0,z.Z)("span",{target:"exg6vvm12"})((function(e){return{marginBottom:e.theme.spacing.twoXS}}),""),R=(0,z.Z)("div",{target:"exg6vvm11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),C=(0,z.Z)("div",{target:"exg6vvm10"})((function(e){var t=e.theme;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),U=(0,z.Z)("ul",{target:"exg6vvm9"})((function(){return{listStyleType:"none",marginBottom:0}}),""),P=(0,z.Z)("li",{target:"exg6vvm8"})((function(e){var t=e.theme;return{margin:t.spacing.none,padding:t.spacing.none}}),""),T=(0,z.Z)("div",{target:"exg6vvm7"})((function(e){return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.theme.spacing.lg,overflow:"hidden"}}),""),X=(0,z.Z)("div",{target:"exg6vvm6"})((function(e){var t=e.theme;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),A=(0,z.Z)("div",{target:"exg6vvm5"})((function(e){return{display:"flex",alignItems:"center",marginBottom:e.theme.spacing.twoXS}}),""),D=(0,z.Z)("span",{target:"exg6vvm4"})((function(e){return{marginRight:e.theme.spacing.twoXS}}),""),E=(0,z.Z)("div",{target:"exg6vvm3"})((function(e){var t=e.theme;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),N=(0,z.Z)("small",{target:"exg6vvm2"})((function(e){var t=e.theme;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),O=(0,z.Z)("span",{target:"exg6vvm1"})({name:"0",styles:""}),V=function(e){var t;return t={},(0,I.Z)(t,M,{display:"flex",flexDirection:"column",alignItems:"flex-start"}),(0,I.Z)(t,B,{marginBottom:e.spacing.lg}),(0,I.Z)(t,k,{display:"none"}),(0,I.Z)(t,C,{paddingRight:e.spacing.lg}),(0,I.Z)(t,A,{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm}),(0,I.Z)(t,X,{width:e.sizes.full}),(0,I.Z)(t,T,{flexDirection:"column"}),(0,I.Z)(t,N,{height:"auto",whiteSpace:"initial"}),(0,I.Z)(t,O,{display:"none"}),(0,I.Z)(t,P,{margin:e.spacing.none,padding:e.spacing.none}),t},H=(0,z.Z)("div",{target:"exg6vvm0"})((function(e){var t=e.theme;return t.inSidebar?V(t):(0,I.Z)({},"@media (max-width: ".concat(t.breakpoints.sm,")"),V(t))}),""),G=n(66071),W=n(49089),Y=n(49986),q=n(46417),$=function(e){var t=e.multiple,n=e.acceptedExtensions,r=e.maxSizeBytes;return(0,q.jsxs)(B,{children:[(0,q.jsx)(k,{children:(0,q.jsx)(W.ZP,{content:G.n,size:"threeXL"})}),(0,q.jsxs)(R,{children:[(0,q.jsxs)(L,{children:["Drag and drop file",t?"s":""," here"]}),(0,q.jsxs)(Y.x,{children:["Limit ".concat(y(r,i.Byte,0)," per file"),n.length?" \u2022 ".concat(n.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},_=function(e){var t=e.onDrop,n=e.multiple,i=e.acceptedExtensions,r=e.maxSizeBytes,a=e.disabled,s=e.label;return(0,q.jsx)(Z.ZP,{onDrop:t,multiple:n,accept:i.length?i:void 0,maxSize:r,disabled:a,useFsAccessApi:!1,children:function(e){var t=e.getRootProps,o=e.getInputProps;return(0,q.jsxs)(M,(0,F.Z)((0,F.Z)({},t()),{},{"data-testid":"stFileUploadDropzone",isDisabled:a,"aria-label":s,children:[(0,q.jsx)("input",(0,F.Z)({},o())),(0,q.jsx)($,{multiple:n,acceptedExtensions:i,maxSizeBytes:r}),(0,q.jsx)(j.ZP,{kind:j.hY.SECONDARY,disabled:a,size:j.$u.SMALL,children:"Browse files"})]}))}})},K=n(29439),J=n(45987),Q=n(67861),ee=n.n(Q),te=n(71054),ne=n(87669),ie=(0,z.Z)("div",{target:"e1f8s2qs1"})((function(e){var t=e.theme;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),re=(0,z.Z)("div",{target:"e1f8s2qs0"})((function(e){return{display:"flex",alignItems:"center",justifyContent:"center",color:e.theme.colors.fadedText40}}),""),ae=function(e){var t=e.className,n=e.currentPage,i=e.totalPages,r=e.onNext,a=e.onPrevious;return(0,q.jsxs)(ie,{className:t,children:[(0,q.jsx)(Y.x,{children:"Showing page ".concat(n," of ").concat(i)}),(0,q.jsxs)(re,{children:[(0,q.jsx)(j.ZP,{onClick:a,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:te.s,size:"xl"})}),(0,q.jsx)(j.ZP,{onClick:r,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ne._,size:"xl"})})]})]})},se=n(74424),oe=["pageSize","items","resetOnAdd"],le=function(e,t){return Math.ceil(e.length/t)},de=function(e){return ee()((function(t){var n=t.pageSize,i=t.items,r=t.resetOnAdd,a=(0,J.Z)(t,oe),s=(0,p.useState)(0),o=(0,K.Z)(s,2),l=o[0],d=o[1],u=(0,p.useState)(le(i,n)),c=(0,K.Z)(u,2),g=c[0],f=c[1],m=(0,se.D)(i);(0,p.useEffect)((function(){m&&m.length!==i.length&&f(le(i,n)),m&&m.length<i.length?r&&d(0):l+1>=g&&d(g-1)}),[i,l,n,m,r,g]);var h=i.slice(l*n,l*n+n);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(e,(0,F.Z)({items:h},a)),i.length>n?(0,q.jsx)(ae,{className:"streamlit-paginator",pageSize:n,totalPages:g,currentPage:l+1,onNext:function(){d(Math.min(l+1,g-1))},onPrevious:function(){d(Math.max(0,l-1))}}):null]})}),e)},ue=n(2029),ce=n(70782),ge=n(98664),pe=n(4371),fe=function(e){var t=e.fileInfo;return"uploading"===t.status.type?(0,q.jsx)(pe.Z,{value:t.status.progress,size:pe.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,q.jsxs)(N,{children:[(0,q.jsx)(D,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,q.jsx)(O,{children:(0,q.jsx)(W.ZP,{content:ue.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,q.jsx)(Y.x,{children:y(t.size,i.Byte)}):null},me=function(e){var t=e.fileInfo,n=e.onDelete;return(0,q.jsxs)(A,{className:"uploadedFile",children:[(0,q.jsx)(E,{children:(0,q.jsx)(W.ZP,{content:ce.h,size:"twoXL"})}),(0,q.jsxs)(T,{className:"uploadedFileData",children:[(0,q.jsx)(X,{className:"uploadedFileName",title:t.name,children:t.name}),(0,q.jsx)(fe,{fileInfo:t})]}),(0,q.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,q.jsx)(j.ZP,{onClick:function(){return n(t.id)},kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ge.U,size:"lg"})})})]})},he=de((function(e){var t=e.items,n=e.onDelete;return(0,q.jsx)(U,{children:t.map((function(e){return(0,q.jsx)(P,{children:(0,q.jsx)(me,{fileInfo:e,onDelete:n})},e.id)}))})})),ve=function(e){return(0,q.jsx)(C,{children:(0,q.jsx)(he,(0,F.Z)({},e))})},xe=n(84677),ye=function(e){(0,o.Z)(n,e);var t=(0,l.Z)(n);function n(e){var s;return(0,a.Z)(this,n),(s=t.call(this,e)).formClearHelper=new m.Kz,s.localFileIdCounter=1,s.componentDidUpdate=function(e){var t=s.props,n=t.element,i=t.widgetMgr;if(e.disabled!==s.props.disabled&&s.props.disabled)return s.reset(),void i.setFileUploaderStateValue(n,new f.xO,{fromUi:!1});if("ready"===s.status){var r=s.createWidgetValue();if(void 0!==r){var a=i.getFileUploaderStateValue(n);g().isEqual(r,a)||i.setFileUploaderStateValue(n,r,{fromUi:!0})}}},s.reset=function(){s.setState({files:[]})},s.dropHandler=function(e,t){var n=s.props.element.multipleFiles;if(!n&&0===e.length&&t.length>1){var i=t.findIndex((function(e){return 1===e.errors.length&&"too-many-files"===e.errors[0].code}));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(!n&&e.length>0&&s.state.files.length>0&&s.removeFile(s.state.files[0].id),e.forEach(s.uploadFile),t.length>0){var r=t.map((function(e){var t=e.file;return new xe.R(t.name,t.size,s.nextLocalFileId(),{type:"error",errorMessage:s.getErrorMessage(e.errors[0].code,e.file)})}));s.addFiles(r)}},s.uploadFile=function(e){var t=u().CancelToken.source(),n=new xe.R(e.name,e.size,s.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});s.addFile(n),s.props.uploadClient.uploadFile(s.props.element,e,(function(e){return s.onUploadProgress(e,n.id)}),t.token).then((function(e){return s.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||s.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},s.onUploadComplete=function(e,t){s.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t)}}));var n=s.getFile(e);null!=n&&"uploading"===n.status.type&&s.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},s.getErrorMessage=function(e,t){switch(e){case"file-too-large":return"File must be ".concat(y(s.maxUploadSizeInBytes,i.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},s.deleteFile=function(e){var t=s.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),s.removeFile(e))},s.addFile=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),[e])}}))},s.addFiles=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),(0,r.Z)(e))}}))},s.removeFile=function(e){s.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},s.getFile=function(e){return s.state.files.find((function(t){return t.id===e}))},s.updateFile=function(e,t){s.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},s.onUploadProgress=function(e,t){var n=s.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&s.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},s.onFormCleared=function(){s.setState({files:[]},(function(){var e=s.createWidgetValue();null!=e&&s.props.widgetMgr.setFileUploaderStateValue(s.props.element,e,{fromUi:!0})}))},s.state=s.initialValue,s}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0},n=this.props,i=n.widgetMgr,r=n.element,a=i.getFileUploaderStateValue(r);if(null==a)return t;var s=a.maxFileId,o=a.uploadedFileInfo;return null==s||0===s||null==o?t:{files:o.map((function(t){var n=t.name,i=t.size,r=t.id;return new xe.R(n,i,e.nextLocalFileId(),{type:"uploaded",serverFileId:r})})),newestServerFileId:Number(s)}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maxUploadSizeInBytes",get:function(){return function(e,t,n){if(e<0)throw Error("Size must be 0 or greater");var i=x.findIndex((function(e){return e===t})),r=x.findIndex((function(e){return e===n}));if(-1===i||-1===r)throw Error("Unexpected byte unit provided");if(i===r)return e;var a=Math.abs(i-r),s=Math.pow(v,a);return i>r?e/s:e*s}(this.props.element.maxUploadSizeMb,i.Megabyte,i.Byte)}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,i=e.status;return new f.jM({id:i.serverFileId,name:t,size:n})}));return new f.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.state.files,n=this.props,i=n.element,r=n.disabled,a=n.widgetMgr,s=i.type;this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared);var o=t.slice().reverse();return(0,q.jsxs)(H,{"data-testid":"stFileUploader",children:[(0,q.jsx)(S.ON,{label:i.label,disabled:r,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,q.jsx)(S.dT,{children:(0,q.jsx)(w.ZP,{content:i.help,placement:b.ug.TOP_RIGHT})})}),(0,q.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:s,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:r}),o.length>0&&(0,q.jsx)(ve,{items:o,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(p.PureComponent)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[578],{18578:function(l,e,o){o.r(e),o.d(e,{default:function(){return h}});var r=o(29439),t=o(47313),a=o(83985),c=o(26419),i=o(24483),n=o(1413),p=o(16031),s=o(16168),f=o(81003),y=o(72599);function u(l,e,o){return l=function(l,e){return(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll("#000032",(0,s.By)(e))).replaceAll("#000033",(0,s.He)(e))).replaceAll("#000034",(0,s.Iy)(e)?e.colors.blue80:e.colors.blue40)).replaceAll("#000035",(0,s.ny)(e))).replaceAll("#000036",(0,s.Xy)(e))).replaceAll("#000037",(0,s.yq)(e))).replaceAll("#000038",e.colors.bgColor)).replaceAll("#000039",e.colors.fadedText05)).replaceAll("#000040",e.colors.bgMix)}(l,e),l=function(l,e,o){var r="#000001",t="#000002",a="#000003",c="#000004",i="#000005",n="#000006",p="#000007",f="#000008",y="#000009",u="#000010";if("streamlit"===o){var d=(0,s.iY)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#636efa")).replaceAll(t,"#EF553B")).replaceAll(a,"#00cc96")).replaceAll(c,"#ab63fa")).replaceAll(i,"#FFA15A")).replaceAll(n,"#19d3f3")).replaceAll(p,"#FF6692")).replaceAll(f,"#B6E880")).replaceAll(y,"#FF97FF")).replaceAll(u,"#FECB52");return l}(l,e,o),l=function(l,e,o){var r="#000011",t="#000012",a="#000013",c="#000014",i="#000015",n="#000016",p="#000017",f="#000018",y="#000019",u="#000020";if("streamlit"===o){var d=(0,s.Gy)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#0d0887")).replaceAll(t,"#46039f")).replaceAll(a,"#7201a8")).replaceAll(c,"#9c179e")).replaceAll(i,"#bd3786")).replaceAll(n,"#d8576b")).replaceAll(p,"#ed7953")).replaceAll(f,"#fb9f3a")).replaceAll(y,"#fdca26")).replaceAll(u,"#f0f921");return l}(l,e,o),l=function(l,e,o){var r="#000021",t="#000022",a="#000023",c="#000024",i="#000025",n="#000026",p="#000027",f="#000028",y="#000029",u="#000030",d="#000031";if("streamlit"===o){var A=(0,s.ru)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,A[0])).replaceAll(t,A[1])).replaceAll(a,A[2])).replaceAll(c,A[3])).replaceAll(i,A[4])).replaceAll(n,A[5])).replaceAll(p,A[6])).replaceAll(f,A[7])).replaceAll(y,A[8])).replaceAll(u,A[9])).replaceAll(d,A[10])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#8e0152")).replaceAll(t,"#c51b7d")).replaceAll(a,"#de77ae")).replaceAll(c,"#f1b6da")).replaceAll(i,"#fde0ef")).replaceAll(n,"#f7f7f7")).replaceAll(p,"#e6f5d0")).replaceAll(f,"#b8e186")).replaceAll(y,"#7fbc41")).replaceAll(u,"#4d9221")).replaceAll(d,"#276419");return l}(l,e,o),l}function d(l,e){try{!function(l,e){var o=e.genericFonts,r=e.colors,t=e.fontSizes,a={font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx},title:{color:r.headingColor,subtitleColor:r.bodyText,font:{family:o.headingFont,size:t.mdPx,color:r.headingColor},pad:{l:e.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:t.twoSmPx,color:(0,s.Xy)(e)},side:"top"},valign:"top",bordercolor:r.transparent,borderwidth:e.spacing.nonePx,font:{size:t.twoSmPx,color:(0,s.yq)(e)}},paper_bgcolor:r.bgColor,plot_bgcolor:r.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.twoXLPx},tickcolor:(0,s.ny)(e),tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},gridcolor:(0,s.ny)(e),minor:{gridcolor:(0,s.ny)(e)},automargin:!0},xaxis:{zerolinecolor:(0,s.ny)(e),gridcolor:(0,s.ny)(e),showgrid:!1,tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},tickcolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.xlPx},minor:{gridcolor:(0,s.ny)(e)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:r.bgColor,bordercolor:(0,s.ny)(e),borderwidth:1,x:0}},margin:{pad:e.spacing.smPx,r:e.spacing.nonePx,l:e.spacing.nonePx},hoverlabel:{bgcolor:r.bgColor,bordercolor:r.fadedText10,font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:e.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:r.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,s.Xy)(e),size:t.smPx}},tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx}}},ternary:{gridcolor:(0,s.Xy)(e),bgcolor:r.bgColor,title:{font:{family:o.bodyFont,size:t.smPx}},color:(0,s.Xy)(e),aaxis:{gridcolor:(0,s.Xy)(e),linecolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},baxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},caxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}}}};(0,p.merge)(l,a)}(l.layout.template.layout,e)}catch(r){var o=(0,f.b)(r);(0,y.H)(o)}"title"in l.layout&&(l.layout.title=(0,p.merge)(l.layout.title,{text:"<b>".concat(l.layout.title.text,"</b>")}))}var A=o(46417);function g(l){return!!l}function b(l){var e=l.element,o=l.width,c=l.height,p=e.figure,s=(0,a.u)(),f=(0,t.useCallback)((function(){var l=JSON.parse(u(p.spec,s,e.theme)),r=l.layout.height,t=l.layout.width;return g(c)?(l.layout.width=o,l.layout.height=c):e.useContainerWidth?l.layout.width=o:(l.layout.width=t,l.layout.height=r),"streamlit"===e.theme?d(l,s):l.layout=function(l,e){var o=e.colors,r=e.genericFonts,t={font:{color:o.bodyText,family:r.bodyFont},paper_bgcolor:o.bgColor,plot_bgcolor:o.secondaryBg};return(0,n.Z)((0,n.Z)({},l),{},{font:(0,n.Z)((0,n.Z)({},t.font),l.font),paper_bgcolor:l.paper_bgcolor||t.paper_bgcolor,plot_bgcolor:l.plot_bgcolor||t.plot_bgcolor})}(l.layout,s),l}),[e.theme,e.useContainerWidth,p.spec,c,s,o]),y=(0,t.useState)(JSON.parse(p.config)),b=(0,r.Z)(y,2),h=b[0],m=b[1],x=(0,t.useState)(f()),w=(0,r.Z)(x,2),P=w[0],X=w[1];(0,t.useLayoutEffect)((function(){m(JSON.parse(p.config)),X(f())}),[e,s,c,o,p.config,f]);var z=P.data,F=P.layout,v=P.frames;return(0,A.jsx)(i.Z,{className:"stPlotlyChart",data:z,layout:F,config:h,frames:v},g(c)?"fullscreen":"original")}var h=(0,c.Z)((function(l){var e=l.width,o=l.element,r=l.height;switch(o.chart){case"url":return function(l){var e=l.url,o=l.width,r=l.height||450;return(0,A.jsx)("iframe",{title:"Plotly",src:e,style:{width:o,height:r}})}({url:o.url,height:r,width:e});case"figure":return(0,A.jsx)(b,{width:e,element:o,height:r});default:throw new Error("Unrecognized PlotlyChart type: ".concat(o.chart))}}))}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[578],{18578:function(l,e,o){o.r(e),o.d(e,{default:function(){return h}});var r=o(29439),t=o(47313),a=o(83985),c=o(26419),i=o(24483),n=o(1413),p=o(16031),s=o(81512),f=o(81003),y=o(72599);function u(l,e,o){return l=function(l,e){return(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll("#000032",(0,s.By)(e))).replaceAll("#000033",(0,s.He)(e))).replaceAll("#000034",(0,s.Iy)(e)?e.colors.blue80:e.colors.blue40)).replaceAll("#000035",(0,s.ny)(e))).replaceAll("#000036",(0,s.Xy)(e))).replaceAll("#000037",(0,s.yq)(e))).replaceAll("#000038",e.colors.bgColor)).replaceAll("#000039",e.colors.fadedText05)).replaceAll("#000040",e.colors.bgMix)}(l,e),l=function(l,e,o){var r="#000001",t="#000002",a="#000003",c="#000004",i="#000005",n="#000006",p="#000007",f="#000008",y="#000009",u="#000010";if("streamlit"===o){var d=(0,s.iY)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#636efa")).replaceAll(t,"#EF553B")).replaceAll(a,"#00cc96")).replaceAll(c,"#ab63fa")).replaceAll(i,"#FFA15A")).replaceAll(n,"#19d3f3")).replaceAll(p,"#FF6692")).replaceAll(f,"#B6E880")).replaceAll(y,"#FF97FF")).replaceAll(u,"#FECB52");return l}(l,e,o),l=function(l,e,o){var r="#000011",t="#000012",a="#000013",c="#000014",i="#000015",n="#000016",p="#000017",f="#000018",y="#000019",u="#000020";if("streamlit"===o){var d=(0,s.Gy)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#0d0887")).replaceAll(t,"#46039f")).replaceAll(a,"#7201a8")).replaceAll(c,"#9c179e")).replaceAll(i,"#bd3786")).replaceAll(n,"#d8576b")).replaceAll(p,"#ed7953")).replaceAll(f,"#fb9f3a")).replaceAll(y,"#fdca26")).replaceAll(u,"#f0f921");return l}(l,e,o),l=function(l,e,o){var r="#000021",t="#000022",a="#000023",c="#000024",i="#000025",n="#000026",p="#000027",f="#000028",y="#000029",u="#000030",d="#000031";if("streamlit"===o){var A=(0,s.ru)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,A[0])).replaceAll(t,A[1])).replaceAll(a,A[2])).replaceAll(c,A[3])).replaceAll(i,A[4])).replaceAll(n,A[5])).replaceAll(p,A[6])).replaceAll(f,A[7])).replaceAll(y,A[8])).replaceAll(u,A[9])).replaceAll(d,A[10])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#8e0152")).replaceAll(t,"#c51b7d")).replaceAll(a,"#de77ae")).replaceAll(c,"#f1b6da")).replaceAll(i,"#fde0ef")).replaceAll(n,"#f7f7f7")).replaceAll(p,"#e6f5d0")).replaceAll(f,"#b8e186")).replaceAll(y,"#7fbc41")).replaceAll(u,"#4d9221")).replaceAll(d,"#276419");return l}(l,e,o),l}function d(l,e){try{!function(l,e){var o=e.genericFonts,r=e.colors,t=e.fontSizes,a={font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx},title:{color:r.headingColor,subtitleColor:r.bodyText,font:{family:o.headingFont,size:t.mdPx,color:r.headingColor},pad:{l:e.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:t.twoSmPx,color:(0,s.Xy)(e)},side:"top"},valign:"top",bordercolor:r.transparent,borderwidth:e.spacing.nonePx,font:{size:t.twoSmPx,color:(0,s.yq)(e)}},paper_bgcolor:r.bgColor,plot_bgcolor:r.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.twoXLPx},tickcolor:(0,s.ny)(e),tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},gridcolor:(0,s.ny)(e),minor:{gridcolor:(0,s.ny)(e)},automargin:!0},xaxis:{zerolinecolor:(0,s.ny)(e),gridcolor:(0,s.ny)(e),showgrid:!1,tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},tickcolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.xlPx},minor:{gridcolor:(0,s.ny)(e)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:r.bgColor,bordercolor:(0,s.ny)(e),borderwidth:1,x:0}},margin:{pad:e.spacing.smPx,r:e.spacing.nonePx,l:e.spacing.nonePx},hoverlabel:{bgcolor:r.bgColor,bordercolor:r.fadedText10,font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:e.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:r.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,s.Xy)(e),size:t.smPx}},tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx}}},ternary:{gridcolor:(0,s.Xy)(e),bgcolor:r.bgColor,title:{font:{family:o.bodyFont,size:t.smPx}},color:(0,s.Xy)(e),aaxis:{gridcolor:(0,s.Xy)(e),linecolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},baxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},caxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}}}};(0,p.merge)(l,a)}(l.layout.template.layout,e)}catch(r){var o=(0,f.b)(r);(0,y.H)(o)}"title"in l.layout&&(l.layout.title=(0,p.merge)(l.layout.title,{text:"<b>".concat(l.layout.title.text,"</b>")}))}var A=o(46417);function g(l){return!!l}function b(l){var e=l.element,o=l.width,c=l.height,p=e.figure,s=(0,a.u)(),f=(0,t.useCallback)((function(){var l=JSON.parse(u(p.spec,s,e.theme)),r=l.layout.height,t=l.layout.width;return g(c)?(l.layout.width=o,l.layout.height=c):e.useContainerWidth?l.layout.width=o:(l.layout.width=t,l.layout.height=r),"streamlit"===e.theme?d(l,s):l.layout=function(l,e){var o=e.colors,r=e.genericFonts,t={font:{color:o.bodyText,family:r.bodyFont},paper_bgcolor:o.bgColor,plot_bgcolor:o.secondaryBg};return(0,n.Z)((0,n.Z)({},l),{},{font:(0,n.Z)((0,n.Z)({},t.font),l.font),paper_bgcolor:l.paper_bgcolor||t.paper_bgcolor,plot_bgcolor:l.plot_bgcolor||t.plot_bgcolor})}(l.layout,s),l}),[e.theme,e.useContainerWidth,p.spec,c,s,o]),y=(0,t.useState)(JSON.parse(p.config)),b=(0,r.Z)(y,2),h=b[0],m=b[1],x=(0,t.useState)(f()),w=(0,r.Z)(x,2),P=w[0],X=w[1];(0,t.useLayoutEffect)((function(){m(JSON.parse(p.config)),X(f())}),[e,s,c,o,p.config,f]);var z=P.data,F=P.layout,v=P.frames;return(0,A.jsx)(i.Z,{className:"stPlotlyChart",data:z,layout:F,config:h,frames:v},g(c)?"fullscreen":"original")}var h=(0,c.Z)((function(l){var e=l.width,o=l.element,r=l.height;switch(o.chart){case"url":return function(l){var e=l.url,o=l.width,r=l.height||450;return(0,A.jsx)("iframe",{title:"Plotly",src:e,style:{width:o,height:r}})}({url:o.url,height:r,width:e});case"figure":return(0,A.jsx)(b,{width:e,element:o,height:r});default:throw new Error("Unrecognized PlotlyChart type: ".concat(o.chart))}}))}}]);
@@ -1 +1 @@
1
- (self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[619],{4619:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),l=n(47313),s=n(34862),u=n(38587),p=n.n(u),c=n(83985),d=n(46332),f=n(85540),m=n(58325),h=n(65167),v=(0,n(47167).Z)("div",{target:"ede6r8z0"})((function(e){return{"span[aria-disabled='true']":{background:e.theme.colors.fadedText05}}}),""),g=n(73290),y=n(80213),b=n(24161),x=n(69319),S=n(64243),w=n(46417),k=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new d.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setIntArrayValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){e.props.element.maxSelections&&"select"===t.type&&e.state.value.length>=e.props.element.maxSelections||e.setState(e.generateNewState(t),(function(){e.commitWidgetValue({fromUi:!0})}))},e.filterOptions=function(t,n){if(e.overMaxSelections())return[];var r=t.filter((function(t){return!e.state.value.includes(Number(t.value))}));return(0,x.H)(r,n)},e}return(0,o.Z)(n,[{key:"overMaxSelections",value:function(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}},{key:"getNoResultsMsg",value:function(){if(0===this.props.element.maxSelections)return"No results";var e=1!==this.props.element.maxSelections?"options":"option";return"You can only select up to ".concat(this.props.element.maxSelections," ").concat(e,". Remove an option first.")}},{key:"initialValue",get:function(){var e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"valueFromState",get:function(){var e=this;return this.state.value.map((function(t){var n=e.props.element.options[t];return{value:t.toString(),label:n}}))}},{key:"generateNewState",value:function(e){var t=function(){var t,n=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(n,10)};switch(e.type){case"remove":return{value:p()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error("State transition is unknown: ".concat(e.type))}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.theme,o=t.width,i=t.widgetMgr,a={width:o},l=n.options,u=0===l.length||this.props.disabled,p=0===l.length?"No options to select.":"Choose an option",c=l.map((function(e,t){return{label:e,value:t.toString()}}));this.formClearHelper.manageFormClearListener(i,n.formId,this.onFormCleared);var d=l.length>10;return(0,w.jsxs)("div",{className:"row-widget stMultiSelect",style:a,children:[(0,w.jsx)(h.ON,{label:n.label,disabled:u,labelVisibility:(0,S.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,w.jsx)(h.dT,{children:(0,w.jsx)(g.ZP,{content:n.help,placement:y.ug.TOP_RIGHT})})}),(0,w.jsx)(v,{children:(0,w.jsx)(f.Z,{options:c,labelKey:"label",valueKey:"value","aria-label":n.label,placeholder:p,type:m.wD.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:u,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{IconsContainer:{style:function(){return{paddingRight:r.spacing.sm}}},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:function(){return{flex:"inherit"}}},ValueContainer:{style:function(){return{minHeight:"38.4px",paddingLeft:r.spacing.sm,paddingTop:0,paddingBottom:0,paddingRight:0}}},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.darkGray,transform:"scale(1.5)",width:r.spacing.twoXL,":hover":{fill:r.colors.bodyText}}}}}},SearchIcon:{style:{color:r.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:r.radii.md,borderTopRightRadius:r.radii.md,borderBottomRightRadius:r.radii.md,borderBottomLeftRadius:r.radii.md,fontSize:r.fontSizes.sm,paddingLeft:r.spacing.sm,marginLeft:0,marginRight:r.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:r.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:r.fontSizes.sm}}}}},Input:{props:{readOnly:s.tq&&!1===d?"readonly":null}},Dropdown:{component:b.s}}})})]})}}]),n}(l.PureComponent),C=(0,c.b)(k)},34405:function(e,t,n){var r=n(99038);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},86722:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}},29131:function(e,t,n){var r=n(44526),o=n(34405),i=n(86722),a=n(95434),l=n(36902),s=n(88905);e.exports=function(e,t,n,u){var p=-1,c=o,d=!0,f=e.length,m=[],h=t.length;if(!f)return m;n&&(t=a(t,l(n))),u?(c=i,d=!1):t.length>=200&&(c=s,d=!1,t=new r(t));e:for(;++p<f;){var v=e[p],g=null==n?v:n(v);if(v=u||0!==v?v:0,d&&g===g){for(var y=h;y--;)if(t[y]===g)continue e;m.push(v)}else c(t,g,u)||m.push(v)}return m}},93527:function(e){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},99038:function(e,t,n){var r=n(93527),o=n(57700),i=n(13245);e.exports=function(e,t,n){return t===t?i(e,t,n):r(e,o,n)}},57700:function(e){e.exports=function(e){return e!==e}},13245:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},38587:function(e,t,n){var r=n(29131),o=n(44409),i=n(79312),a=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=a}}]);
1
+ (self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[619],{4619:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),l=n(47313),s=n(34862),u=n(38587),p=n.n(u),c=n(83985),d=n(46332),f=n(85540),m=n(58325),h=n(65167),v=(0,n(47167).Z)("div",{target:"ede6r8z0"})((function(e){return{"span[aria-disabled='true']":{background:e.theme.colors.fadedText05}}}),""),g=n(73290),y=n(10612),b=n(24161),x=n(69319),S=n(64243),w=n(46417),k=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new d.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setIntArrayValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){e.props.element.maxSelections&&"select"===t.type&&e.state.value.length>=e.props.element.maxSelections||e.setState(e.generateNewState(t),(function(){e.commitWidgetValue({fromUi:!0})}))},e.filterOptions=function(t,n){if(e.overMaxSelections())return[];var r=t.filter((function(t){return!e.state.value.includes(Number(t.value))}));return(0,x.H)(r,n)},e}return(0,o.Z)(n,[{key:"overMaxSelections",value:function(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}},{key:"getNoResultsMsg",value:function(){if(0===this.props.element.maxSelections)return"No results";var e=1!==this.props.element.maxSelections?"options":"option";return"You can only select up to ".concat(this.props.element.maxSelections," ").concat(e,". Remove an option first.")}},{key:"initialValue",get:function(){var e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"valueFromState",get:function(){var e=this;return this.state.value.map((function(t){var n=e.props.element.options[t];return{value:t.toString(),label:n}}))}},{key:"generateNewState",value:function(e){var t=function(){var t,n=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(n,10)};switch(e.type){case"remove":return{value:p()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error("State transition is unknown: ".concat(e.type))}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.theme,o=t.width,i=t.widgetMgr,a={width:o},l=n.options,u=0===l.length||this.props.disabled,p=0===l.length?"No options to select.":"Choose an option",c=l.map((function(e,t){return{label:e,value:t.toString()}}));this.formClearHelper.manageFormClearListener(i,n.formId,this.onFormCleared);var d=l.length>10;return(0,w.jsxs)("div",{className:"row-widget stMultiSelect",style:a,children:[(0,w.jsx)(h.ON,{label:n.label,disabled:u,labelVisibility:(0,S.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,w.jsx)(h.dT,{children:(0,w.jsx)(g.ZP,{content:n.help,placement:y.ug.TOP_RIGHT})})}),(0,w.jsx)(v,{children:(0,w.jsx)(f.Z,{options:c,labelKey:"label",valueKey:"value","aria-label":n.label,placeholder:p,type:m.wD.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:u,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{IconsContainer:{style:function(){return{paddingRight:r.spacing.sm}}},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:function(){return{flex:"inherit"}}},ValueContainer:{style:function(){return{minHeight:"38.4px",paddingLeft:r.spacing.sm,paddingTop:0,paddingBottom:0,paddingRight:0}}},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.darkGray,transform:"scale(1.5)",width:r.spacing.twoXL,":hover":{fill:r.colors.bodyText}}}}}},SearchIcon:{style:{color:r.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:r.radii.md,borderTopRightRadius:r.radii.md,borderBottomRightRadius:r.radii.md,borderBottomLeftRadius:r.radii.md,fontSize:r.fontSizes.sm,paddingLeft:r.spacing.sm,marginLeft:0,marginRight:r.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:r.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:r.fontSizes.sm}}}}},Input:{props:{readOnly:s.tq&&!1===d?"readonly":null}},Dropdown:{component:b.s}}})})]})}}]),n}(l.PureComponent),C=(0,c.b)(k)},34405:function(e,t,n){var r=n(99038);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},86722:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}},29131:function(e,t,n){var r=n(44526),o=n(34405),i=n(86722),a=n(95434),l=n(36902),s=n(88905);e.exports=function(e,t,n,u){var p=-1,c=o,d=!0,f=e.length,m=[],h=t.length;if(!f)return m;n&&(t=a(t,l(n))),u?(c=i,d=!1):t.length>=200&&(c=s,d=!1,t=new r(t));e:for(;++p<f;){var v=e[p],g=null==n?v:n(v);if(v=u||0!==v?v:0,d&&g===g){for(var y=h;y--;)if(t[y]===g)continue e;m.push(v)}else c(t,g,u)||m.push(v)}return m}},93527:function(e){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},99038:function(e,t,n){var r=n(93527),o=n(57700),i=n(13245);e.exports=function(e,t,n){return t===t?i(e,t,n):r(e,o,n)}},57700:function(e){e.exports=function(e){return e!==e}},13245:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},38587:function(e,t,n){var r=n(29131),o=n(44409),i=n(79312),a=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=a}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[628],{75006:function(e,t,n){n.d(t,{Z:function(){return f}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),u=n(30168),l=n(47167),c=(0,n(30686).F4)(r||(r=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),s=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(c),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=n(46417),f=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,u=e.type,l=[],c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(s,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,p.jsx)(i.X7,{className:a,children:l})}},14628:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),u=n(47313),l=n(3208),c=n(7976),s=n(46332),p=n(75006),f=n(65167),d=n(73290),y=n(80213),h=n(64243),m=(0,n(47167).Z)("div",{target:"edfmue0"})((function(e){return{position:"relative",width:e.width}}),""),b=n(46417),v=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new s.Kz,e.state={dirty:!1,value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t),e.setState({dirty:!1})},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onBlur=function(){e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e.onChange=function(t){var n=t.target.value,r=e.props.element.maxChars;0!==r&&n.length>r||((0,h.$b)(e.props.element)?e.setState({dirty:!1,value:n},(function(){return e.commitWidgetValue({fromUi:!0})})):e.setState({dirty:!0,value:n}))},e.onKeyPress=function(t){"Enter"===t.key&&e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e}return(0,o.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"getTypeString",value:function(){return this.props.element.type===c.oi.Type.PASSWORD?"password":"text"}},{key:"render",value:function(){var e,t=this.state,n=t.dirty,r=t.value,o=this.props,i=o.element,a=o.width,u=o.disabled,c=o.widgetMgr,s=i.placeholder;return this.formClearHelper.manageFormClearListener(c,i.formId,this.onFormCleared),(0,b.jsxs)(m,{className:"row-widget stTextInput",width:a,children:[(0,b.jsx)(f.ON,{label:i.label,disabled:u,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,b.jsx)(f.dT,{children:(0,b.jsx)(d.ZP,{content:i.help,placement:y.ug.TOP_RIGHT})})}),(0,b.jsx)(l.Z,{value:r,placeholder:s,onBlur:this.onBlur,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":i.label,disabled:u,type:this.getTypeString(),autoComplete:i.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:"1.4",paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}},Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}}}}),(0,b.jsx)(p.Z,{dirty:n,value:r,maxLength:i.maxChars})]})}}]),n}(u.PureComponent),g=v},3208:function(e,t,n){var r=n(47313),o=n(74969),i=n(84886),a=n(53998),u=n(12903),l=n(37613);function c(e){return c="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},c(e)}var s=["Root","StartEnhancer","EndEnhancer"],p=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(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 y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function g(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 n,r=O(e);if(t){var o=O(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=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&&v(e,t)}(w,e);var t,n,c,y=g(w);function w(){var e;m(this,w);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(j(e=y.call.apply(y,[this].concat(n))),"state",{isFocused:e.props.autoFocus||!1}),P(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),P(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=w,(n=[{key:"render",value:function(){var e=this.props,t=e.startEnhancer,n=e.endEnhancer,c=e.overrides,y=c.Root,m=c.StartEnhancer,b=c.EndEnhancer,v=h(c,s),g=h(e,p),w=d((0,o.jb)(y,u.fC),2),j=w[0],O=w[1],P=d((0,o.jb)(m,u.Fp),2),S=P[0],C=P[1],F=d((0,o.jb)(b,u.Fp),2),k=F[0],V=F[1],B=(0,i.t)(this.props,this.state);return r.createElement(j,f({"data-baseweb":"input"},B,O,{$adjoined:E(t,n),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),x(t)&&r.createElement(S,f({},B,C,{$position:l.Xf.start}),"function"===typeof t?t(B):t),r.createElement(a.Z,f({},g,{overrides:v,adjoined:E(t,n),onFocus:this.onFocus,onBlur:this.onBlur})),x(n)&&r.createElement(k,f({},B,V,{$position:l.Xf.end}),"function"===typeof n?n(B):n))}}])&&b(t.prototype,n),c&&b(t,c),Object.defineProperty(t,"prototype",{writable:!1}),w}(r.Component);function E(e,t){return x(e)&&x(t)?l.y4.both:x(e)?l.y4.left:x(t)?l.y4.right:l.y4.none}function x(e){return Boolean(e||0===e)}P(S,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.NO.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1}),t.Z=S}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[628],{75006:function(e,t,n){n.d(t,{Z:function(){return f}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),u=n(30168),l=n(47167),c=(0,n(30686).F4)(r||(r=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),s=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(c),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=n(46417),f=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,u=e.type,l=[],c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(s,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,p.jsx)(i.X7,{className:a,children:l})}},14628:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),u=n(47313),l=n(3208),c=n(7976),s=n(46332),p=n(75006),f=n(65167),d=n(73290),y=n(10612),h=n(64243),m=(0,n(47167).Z)("div",{target:"edfmue0"})((function(e){return{position:"relative",width:e.width}}),""),b=n(46417),v=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new s.Kz,e.state={dirty:!1,value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t),e.setState({dirty:!1})},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onBlur=function(){e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e.onChange=function(t){var n=t.target.value,r=e.props.element.maxChars;0!==r&&n.length>r||((0,h.$b)(e.props.element)?e.setState({dirty:!1,value:n},(function(){return e.commitWidgetValue({fromUi:!0})})):e.setState({dirty:!0,value:n}))},e.onKeyPress=function(t){"Enter"===t.key&&e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e}return(0,o.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"getTypeString",value:function(){return this.props.element.type===c.oi.Type.PASSWORD?"password":"text"}},{key:"render",value:function(){var e,t=this.state,n=t.dirty,r=t.value,o=this.props,i=o.element,a=o.width,u=o.disabled,c=o.widgetMgr,s=i.placeholder;return this.formClearHelper.manageFormClearListener(c,i.formId,this.onFormCleared),(0,b.jsxs)(m,{className:"row-widget stTextInput",width:a,children:[(0,b.jsx)(f.ON,{label:i.label,disabled:u,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,b.jsx)(f.dT,{children:(0,b.jsx)(d.ZP,{content:i.help,placement:y.ug.TOP_RIGHT})})}),(0,b.jsx)(l.Z,{value:r,placeholder:s,onBlur:this.onBlur,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":i.label,disabled:u,type:this.getTypeString(),autoComplete:i.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:"1.4",paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}},Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}}}}),(0,b.jsx)(p.Z,{dirty:n,value:r,maxLength:i.maxChars})]})}}]),n}(u.PureComponent),g=v},3208:function(e,t,n){var r=n(47313),o=n(74969),i=n(84886),a=n(53998),u=n(12903),l=n(37613);function c(e){return c="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},c(e)}var s=["Root","StartEnhancer","EndEnhancer"],p=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(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 y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function g(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 n,r=O(e);if(t){var o=O(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=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&&v(e,t)}(w,e);var t,n,c,y=g(w);function w(){var e;m(this,w);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(j(e=y.call.apply(y,[this].concat(n))),"state",{isFocused:e.props.autoFocus||!1}),P(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),P(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=w,(n=[{key:"render",value:function(){var e=this.props,t=e.startEnhancer,n=e.endEnhancer,c=e.overrides,y=c.Root,m=c.StartEnhancer,b=c.EndEnhancer,v=h(c,s),g=h(e,p),w=d((0,o.jb)(y,u.fC),2),j=w[0],O=w[1],P=d((0,o.jb)(m,u.Fp),2),S=P[0],C=P[1],F=d((0,o.jb)(b,u.Fp),2),k=F[0],V=F[1],B=(0,i.t)(this.props,this.state);return r.createElement(j,f({"data-baseweb":"input"},B,O,{$adjoined:E(t,n),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),x(t)&&r.createElement(S,f({},B,C,{$position:l.Xf.start}),"function"===typeof t?t(B):t),r.createElement(a.Z,f({},g,{overrides:v,adjoined:E(t,n),onFocus:this.onFocus,onBlur:this.onBlur})),x(n)&&r.createElement(k,f({},B,V,{$position:l.Xf.end}),"function"===typeof n?n(B):n))}}])&&b(t.prototype,n),c&&b(t,c),Object.defineProperty(t,"prototype",{writable:!1}),w}(r.Component);function E(e,t){return x(e)&&x(t)?l.y4.both:x(e)?l.y4.left:x(t)?l.y4.right:l.y4.none}function x(e){return Boolean(e||0===e)}P(S,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.NO.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1}),t.Z=S}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[681],{4371:function(e,t,n){n.d(t,{$:function(){return r},Z:function(){return u}});var r,i=n(47313),o=n(83985),s=n(54922),a=n(16168),l=n(75314),c=n(74969),d=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(r||(r={}));var u=function(e){var t=e.value,n=e.width,u=e.size,g=void 0===u?r.SMALL:u,p=e.overrides,f=(0,o.u)(),h={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},m=i.useContext(s.I).activeTheme,S=!(0,a.MJ)(m),v={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:h[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:S?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,d.jsx)(l.Z,{value:t,overrides:(0,c.aO)(v,p)})}},44681:function(e,t,n){n.r(t),n.d(t,{default:function(){return ee}});var r,i=n(93433),o=n(15671),s=n(43144),a=n(60136),l=n(29388),c=n(92653),d=n(31881),u=n.n(d),g=n(16031),p=n.n(g),f=n(47313),h=n(7976),m=n(49089),S=n(80213),v=n(73290),w=n(65167),R=n(46332),x=n(72599),b=n(64243),F=n(84677),C=n(4371),I=n(1413),j=n(47167),y=n(2120);!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(r||(r={}));var E=(0,j.Z)("div",{target:"ejtjsn29"})((function(){return{position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}}),""),P=(0,j.Z)("div",{target:"ejtjsn28"})((function(e){var t=e.theme,n=e.width;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),width:"100%",height:9*n/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),M=(0,j.Z)("p",{target:"ejtjsn27"})((function(e){return{marginTop:e.theme.spacing.sm,textAlign:"center"}}),""),T=(0,j.Z)("img",{target:"ejtjsn26"})((function(e){var t=e.theme,n=e.opacity;return{borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),objectFit:"contain",opacity:n}}),""),L=(0,j.Z)("a",{target:"ejtjsn25"})((function(e){return{color:e.theme.colors.primary,display:"block",textDecoration:"none"}}),""),k=(0,j.Z)("span",{target:"ejtjsn24"})((function(){return{display:"flex",alignItems:"center"}}),""),U=(0,j.Z)("div",{target:"ejtjsn23"})((function(e){var t=e.theme;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),Z=(0,j.Z)("div",{target:"ejtjsn21"})((function(){return{height:"fit-content",width:"100%",position:"absolute",bottom:0}}),""),D=(0,j.Z)("button",{target:"ejtjsn20"})((function(e){var t=e.theme;return(0,I.Z)({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.md," ").concat(t.radii.md),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,y.DZ)(t.colors.primary,.5))}},function(e,t){switch(e){case r.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case r.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case r.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}(r.MEDIUM,t))}),""),X=n(46417);var O,A=function(e){var t=e.disabled,n=e.onClick,r=e.children,i=e.progress;return(0,X.jsxs)(D,{disabled:t||!1,onClick:n||function(){},progress:i||null,"data-testid":"stCameraInputButton",children:[r,i&&(0,X.jsx)(Z,{children:(0,X.jsx)(C.Z,{value:i,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})},B=n(29975),N=n(69367),_=n(5207);!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));var z,G=function(e){var t=e.switchFacingMode;return(0,X.jsx)(U,{children:(0,X.jsx)(S.ZP,{content:"Switch camera",placement:S.ug.TOP_RIGHT,children:(0,X.jsx)(N.ZP,{kind:N.hY.MINIMAL,onClick:t,children:(0,X.jsx)(m.ZP,{content:B.Z,size:"twoXL",color:_.Z.white})})})})},V=n(29439),W=n(86101),H=n(83985),$=n(34862),q=n(62790),J=n.n(q),K=n(73989);!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(z||(z={}));var Q=function(e){var t=e.width;return(0,X.jsxs)(P,{width:t,children:[(0,X.jsx)(m.ZP,{size:"threeXL",color:_.Z.gray60,content:W.n}),(0,X.jsxs)(M,{children:["This app would like to use your camera.",(0,X.jsx)(L,{href:K.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},Y=function(e){var t=e.handleCapture,n=e.width,r=e.disabled,i=e.clearPhotoInProgress,o=e.setClearPhotoInProgress,s=e.facingMode,a=e.setFacingMode,l=(0,f.useState)(z.PENDING),c=(0,V.Z)(l,2),d=c[0],u=c[1],g=(0,f.useRef)(null),p=(0,f.useState)(n),h=(0,V.Z)(p,2),m=h[0],S=h[1],v=(0,f.useCallback)((function(e){return(0,b.Ds)(1e3,S(e))}),[]);(0,f.useEffect)((function(){v(n)}),[n,v]);var w=(0,H.u)();return(0,X.jsxs)(E,{width:m,children:[d===z.SUCCESS||r||i?$.tq&&(0,X.jsx)(G,{switchFacingMode:a}):(0,X.jsx)(Q,{width:m}),(0,X.jsx)(P,{hidden:d!==z.SUCCESS&&!r&&!i,width:m,children:!r&&(0,X.jsx)(J(),{audio:!1,ref:g,screenshotFormat:"image/jpeg",screenshotQuality:1,width:m,height:9*m/16,style:{borderRadius:"".concat(w.radii.md," ").concat(w.radii.md," 0 0")},onUserMediaError:function(){u(z.ERROR)},onUserMedia:function(){u(z.SUCCESS),o(!1)},videoConstraints:{width:{ideal:m},facingMode:s}})}),(0,X.jsx)(A,{onClick:function(){if(null!==g.current){var e=g.current.getScreenshot();t(e)}},disabled:d!==z.SUCCESS||r||i,children:"Take Photo"})]})};var ee=function(e){(0,a.Z)(n,e);var t=(0,l.Z)(n);function n(e){var r;return(0,o.Z)(this,n),(r=t.call(this,e)).localFileIdCounter=1,r.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",r.formClearHelper=new R.Kz,r.getProgress=function(){if(r.state.files.length>0&&"uploading"===r.state.files[r.state.files.length-1].status.type)return r.state.files[r.state.files.length-1].status.progress},r.setClearPhotoInProgress=function(e){r.setState({clearPhotoInProgress:e})},r.setFacingMode=function(){r.setState((function(e){return{facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER}}))},r.handleCapture=function(e){if(null===e)return Promise.resolve();r.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,n;return(t=e,n="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],n,{type:"image/jpeg"})}))).then((function(e){return r.uploadFile(e)})).then((function(){return e=150,new Promise((function(t){return setTimeout(t,e)}));var e})).then((function(){r.setState((function(t,n){return{imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0}}))})).catch((function(e){(0,x.H)(e)}))},r.removeCapture=function(){0!==r.state.files.length&&(r.state.files.forEach((function(e){return r.deleteFile(e.id)})),r.setState({imgSrc:null,clearPhotoInProgress:!0}))},r.componentDidUpdate=function(e){var t=r.props,n=t.element,i=t.widgetMgr;if(e.disabled!==r.props.disabled&&r.props.disabled)return r.reset(),void i.setFileUploaderStateValue(n,new h.xO,{fromUi:!1});if("ready"===r.status){var o=r.createWidgetValue();if(void 0!==o){var s=i.getFileUploaderStateValue(n);p().isEqual(o,s)||i.setFileUploaderStateValue(n,o,{fromUi:!0})}}},r.onFormCleared=function(){r.setState({files:[]},(function(){var e=r.createWidgetValue();null!=e&&(r.setState({imgSrc:null}),r.props.widgetMgr.setFileUploaderStateValue(r.props.element,e,{fromUi:!0}))}))},r.deleteFile=function(e){var t=r.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),r.removeFile(e))},r.addFile=function(e){r.setState((function(t){return{files:[].concat((0,i.Z)(t.files),[e])}}))},r.removeFile=function(e){r.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},r.getFile=function(e){return r.state.files.find((function(t){return t.id===e}))},r.updateFile=function(e,t){r.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},r.onUploadComplete=function(e,t){r.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1}}));var n=r.getFile(e);null!=n&&"uploading"===n.status.type&&r.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},r.onUploadProgress=function(e,t){var n=r.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&r.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},r.reset=function(){r.setState({files:[],imgSrc:null})},r.uploadFile=function(e){var t=u().CancelToken.source(),n=new F.R(e.name,e.size,r.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});r.addFile(n),r.props.uploadClient.uploadFile(r.props.element,e,(function(e){return r.onUploadProgress(e,n.id)}),t.token).then((function(e){return r.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||r.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},r.state=r.initialValue,r}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},n=this.props,r=n.widgetMgr,i=n.element,o=r.getFileUploaderStateValue(i);if(null==o)return t;var s=o.maxFileId,a=o.uploadedFileInfo;return null==s||0===s||null==a?t:{files:a.map((function(t){var n=t.name,r=t.size,i=t.id;return new F.R(n,r,e.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(s),imgSrc:0===a.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,r=e.status;return new h.jM({id:r.serverFileId,name:t,size:n})}));return new h.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.widgetMgr,i=t.disabled,o=t.width;return this.formClearHelper.manageFormClearListener(r,n.formId,this.onFormCleared),(0,X.jsxs)(E,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,X.jsx)(w.ON,{label:n.label,disabled:i,labelVisibility:(0,b.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,X.jsx)(w.dT,{children:(0,X.jsx)(v.ZP,{content:n.help,placement:S.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,X.jsx)(T,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,X.jsx)(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,X.jsxs)(k,{children:[(0,X.jsx)(m.ZP,{content:c.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,X.jsx)(Y,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(f.PureComponent)},84677:function(e,t,n){n.d(t,{R:function(){return o}});var r=n(15671),i=n(43144),o=function(){function e(t,n,i,o){(0,r.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=i,this.status=o}return(0,i.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[681],{4371:function(e,t,n){n.d(t,{$:function(){return r},Z:function(){return u}});var r,i=n(47313),o=n(83985),s=n(54922),a=n(81512),l=n(75314),c=n(74969),d=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(r||(r={}));var u=function(e){var t=e.value,n=e.width,u=e.size,g=void 0===u?r.SMALL:u,p=e.overrides,f=(0,o.u)(),h={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},m=i.useContext(s.I).activeTheme,S=!(0,a.MJ)(m),v={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:h[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:S?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,d.jsx)(l.Z,{value:t,overrides:(0,c.aO)(v,p)})}},44681:function(e,t,n){n.r(t),n.d(t,{default:function(){return ee}});var r,i=n(93433),o=n(15671),s=n(43144),a=n(60136),l=n(29388),c=n(92653),d=n(31881),u=n.n(d),g=n(16031),p=n.n(g),f=n(47313),h=n(7976),m=n(49089),S=n(10612),v=n(73290),w=n(65167),R=n(46332),x=n(72599),b=n(64243),F=n(84677),C=n(4371),I=n(1413),j=n(47167),y=n(2120);!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(r||(r={}));var E=(0,j.Z)("div",{target:"ejtjsn29"})((function(){return{position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}}),""),P=(0,j.Z)("div",{target:"ejtjsn28"})((function(e){var t=e.theme,n=e.width;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),width:"100%",height:9*n/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),M=(0,j.Z)("p",{target:"ejtjsn27"})((function(e){return{marginTop:e.theme.spacing.sm,textAlign:"center"}}),""),T=(0,j.Z)("img",{target:"ejtjsn26"})((function(e){var t=e.theme,n=e.opacity;return{borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),objectFit:"contain",opacity:n}}),""),L=(0,j.Z)("a",{target:"ejtjsn25"})((function(e){return{color:e.theme.colors.primary,display:"block",textDecoration:"none"}}),""),k=(0,j.Z)("span",{target:"ejtjsn24"})((function(){return{display:"flex",alignItems:"center"}}),""),U=(0,j.Z)("div",{target:"ejtjsn23"})((function(e){var t=e.theme;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),Z=(0,j.Z)("div",{target:"ejtjsn21"})((function(){return{height:"fit-content",width:"100%",position:"absolute",bottom:0}}),""),D=(0,j.Z)("button",{target:"ejtjsn20"})((function(e){var t=e.theme;return(0,I.Z)({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.md," ").concat(t.radii.md),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,y.DZ)(t.colors.primary,.5))}},function(e,t){switch(e){case r.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case r.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case r.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}(r.MEDIUM,t))}),""),X=n(46417);var O,A=function(e){var t=e.disabled,n=e.onClick,r=e.children,i=e.progress;return(0,X.jsxs)(D,{disabled:t||!1,onClick:n||function(){},progress:i||null,"data-testid":"stCameraInputButton",children:[r,i&&(0,X.jsx)(Z,{children:(0,X.jsx)(C.Z,{value:i,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})},B=n(29975),N=n(69367),_=n(5207);!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));var z,G=function(e){var t=e.switchFacingMode;return(0,X.jsx)(U,{children:(0,X.jsx)(S.ZP,{content:"Switch camera",placement:S.ug.TOP_RIGHT,children:(0,X.jsx)(N.ZP,{kind:N.hY.MINIMAL,onClick:t,children:(0,X.jsx)(m.ZP,{content:B.Z,size:"twoXL",color:_.Z.white})})})})},V=n(29439),W=n(86101),H=n(83985),$=n(34862),q=n(62790),J=n.n(q),K=n(73989);!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(z||(z={}));var Q=function(e){var t=e.width;return(0,X.jsxs)(P,{width:t,children:[(0,X.jsx)(m.ZP,{size:"threeXL",color:_.Z.gray60,content:W.n}),(0,X.jsxs)(M,{children:["This app would like to use your camera.",(0,X.jsx)(L,{href:K.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},Y=function(e){var t=e.handleCapture,n=e.width,r=e.disabled,i=e.clearPhotoInProgress,o=e.setClearPhotoInProgress,s=e.facingMode,a=e.setFacingMode,l=(0,f.useState)(z.PENDING),c=(0,V.Z)(l,2),d=c[0],u=c[1],g=(0,f.useRef)(null),p=(0,f.useState)(n),h=(0,V.Z)(p,2),m=h[0],S=h[1],v=(0,f.useCallback)((function(e){return(0,b.Ds)(1e3,S(e))}),[]);(0,f.useEffect)((function(){v(n)}),[n,v]);var w=(0,H.u)();return(0,X.jsxs)(E,{width:m,children:[d===z.SUCCESS||r||i?$.tq&&(0,X.jsx)(G,{switchFacingMode:a}):(0,X.jsx)(Q,{width:m}),(0,X.jsx)(P,{hidden:d!==z.SUCCESS&&!r&&!i,width:m,children:!r&&(0,X.jsx)(J(),{audio:!1,ref:g,screenshotFormat:"image/jpeg",screenshotQuality:1,width:m,height:9*m/16,style:{borderRadius:"".concat(w.radii.md," ").concat(w.radii.md," 0 0")},onUserMediaError:function(){u(z.ERROR)},onUserMedia:function(){u(z.SUCCESS),o(!1)},videoConstraints:{width:{ideal:m},facingMode:s}})}),(0,X.jsx)(A,{onClick:function(){if(null!==g.current){var e=g.current.getScreenshot();t(e)}},disabled:d!==z.SUCCESS||r||i,children:"Take Photo"})]})};var ee=function(e){(0,a.Z)(n,e);var t=(0,l.Z)(n);function n(e){var r;return(0,o.Z)(this,n),(r=t.call(this,e)).localFileIdCounter=1,r.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",r.formClearHelper=new R.Kz,r.getProgress=function(){if(r.state.files.length>0&&"uploading"===r.state.files[r.state.files.length-1].status.type)return r.state.files[r.state.files.length-1].status.progress},r.setClearPhotoInProgress=function(e){r.setState({clearPhotoInProgress:e})},r.setFacingMode=function(){r.setState((function(e){return{facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER}}))},r.handleCapture=function(e){if(null===e)return Promise.resolve();r.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,n;return(t=e,n="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],n,{type:"image/jpeg"})}))).then((function(e){return r.uploadFile(e)})).then((function(){return e=150,new Promise((function(t){return setTimeout(t,e)}));var e})).then((function(){r.setState((function(t,n){return{imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0}}))})).catch((function(e){(0,x.H)(e)}))},r.removeCapture=function(){0!==r.state.files.length&&(r.state.files.forEach((function(e){return r.deleteFile(e.id)})),r.setState({imgSrc:null,clearPhotoInProgress:!0}))},r.componentDidUpdate=function(e){var t=r.props,n=t.element,i=t.widgetMgr;if(e.disabled!==r.props.disabled&&r.props.disabled)return r.reset(),void i.setFileUploaderStateValue(n,new h.xO,{fromUi:!1});if("ready"===r.status){var o=r.createWidgetValue();if(void 0!==o){var s=i.getFileUploaderStateValue(n);p().isEqual(o,s)||i.setFileUploaderStateValue(n,o,{fromUi:!0})}}},r.onFormCleared=function(){r.setState({files:[]},(function(){var e=r.createWidgetValue();null!=e&&(r.setState({imgSrc:null}),r.props.widgetMgr.setFileUploaderStateValue(r.props.element,e,{fromUi:!0}))}))},r.deleteFile=function(e){var t=r.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),r.removeFile(e))},r.addFile=function(e){r.setState((function(t){return{files:[].concat((0,i.Z)(t.files),[e])}}))},r.removeFile=function(e){r.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},r.getFile=function(e){return r.state.files.find((function(t){return t.id===e}))},r.updateFile=function(e,t){r.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},r.onUploadComplete=function(e,t){r.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1}}));var n=r.getFile(e);null!=n&&"uploading"===n.status.type&&r.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},r.onUploadProgress=function(e,t){var n=r.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&r.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},r.reset=function(){r.setState({files:[],imgSrc:null})},r.uploadFile=function(e){var t=u().CancelToken.source(),n=new F.R(e.name,e.size,r.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});r.addFile(n),r.props.uploadClient.uploadFile(r.props.element,e,(function(e){return r.onUploadProgress(e,n.id)}),t.token).then((function(e){return r.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||r.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},r.state=r.initialValue,r}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},n=this.props,r=n.widgetMgr,i=n.element,o=r.getFileUploaderStateValue(i);if(null==o)return t;var s=o.maxFileId,a=o.uploadedFileInfo;return null==s||0===s||null==a?t:{files:a.map((function(t){var n=t.name,r=t.size,i=t.id;return new F.R(n,r,e.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(s),imgSrc:0===a.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,r=e.status;return new h.jM({id:r.serverFileId,name:t,size:n})}));return new h.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.widgetMgr,i=t.disabled,o=t.width;return this.formClearHelper.manageFormClearListener(r,n.formId,this.onFormCleared),(0,X.jsxs)(E,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,X.jsx)(w.ON,{label:n.label,disabled:i,labelVisibility:(0,b.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,X.jsx)(w.dT,{children:(0,X.jsx)(v.ZP,{content:n.help,placement:S.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,X.jsx)(T,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,X.jsx)(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,X.jsxs)(k,{children:[(0,X.jsx)(m.ZP,{content:c.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,X.jsx)(Y,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(f.PureComponent)},84677:function(e,t,n){n.d(t,{R:function(){return o}});var r=n(15671),i=n(43144),o=function(){function e(t,n,i,o){(0,r.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=i,this.status=o}return(0,i.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[745],{6745:function(e,t,n){n.r(t),n.d(t,{default:function(){return N}});var a=n(29439),o=n(74165),r=n(15861),i=n(15671),s=n(43144),l=n(60136),d=n(29388),c=n(47313),u=n(83985),h=n(86538),g=n(61469),f=n(29334),m=n(72599),p=n(26419),v=n(81003),b=n(45429),w=n(1413),y=n(16031),x=n(16168);function S(e,t){var n={font:t.genericFonts.bodyFont,background:t.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:t.colors.headingColor,titleFontStyle:"normal",fontWeight:t.fontWeights.bold,fontSize:t.fontSizes.smPx+2,orient:"top",offset:26},axis:{labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,x.Xy)(t),labelFontStyle:"normal",titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.smPx,titleColor:(0,x.Xy)(t),titleFontStyle:"normal",ticks:!1,gridColor:(0,x.ny)(t),domain:!1,domainWidth:1,domainColor:(0,x.ny)(t),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:t.spacing.lgPx,labelPadding:t.spacing.lgPx,labelSeparation:t.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:t.fontSizes.smPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,x.Xy)(t),titleFontSize:t.fontSizes.smPx,titleFontWeight:t.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,x.Xy)(t),titlePadding:t.spacing.mdPx,labelPadding:t.spacing.lgPx,columnPadding:t.spacing.smPx,rowPadding:t.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,x.iY)(t),diverging:(0,x.ru)(t),ramp:(0,x.Gy)(t),heatmap:(0,x.Gy)(t)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:(0,w.Z)({tooltip:!0},(0,x.Iy)(t)?{color:"#0068C9"}:{color:"#83C9FF"}),bar:{binSpacing:t.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return e?(0,y.mergeWith)({},n,e,(function(e,t){return(0,y.isArray)(t)?t:void 0})):n}function F(e,t){var n=t.colors,a=t.fontSizes,o=t.genericFonts,r={labelFont:o.bodyFont,titleFont:o.bodyFont,labelFontSize:a.twoSmPx,titleFontSize:a.twoSmPx},i={background:n.bgColor,axis:(0,w.Z)({labelColor:n.bodyText,titleColor:n.bodyText,gridColor:(0,x.ny)(t)},r),legend:(0,w.Z)({labelColor:n.bodyText,titleColor:n.bodyText},r),title:(0,w.Z)({color:n.bodyText,subtitleColor:n.bodyText},r),header:{labelColor:n.bodyText},view:{continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return e?(0,y.merge)({},i,e):i}var k=(0,n(47167).Z)("div",{target:"everg990"})((function(e){var t=e.theme;return{"&.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 ".concat(t.colors.fadedText10),a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:"".concat(t.spacing.twoXS," ").concat(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}}}}}),""),z=n(46417),C="(index)",V="source",P=new Set([b.GI.DatetimeIndex,b.GI.Float64Index,b.GI.Int64Index,b.GI.RangeIndex,b.GI.UInt64Index]),Z=function(e){(0,l.Z)(n,e);var t=(0,d.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))).vegaView=void 0,e.vegaFinalizer=void 0,e.defaultDataName=V,e.element=null,e.state={error:void 0},e.finalizeView=function(){e.vegaFinalizer&&e.vegaFinalizer(),e.vegaFinalizer=void 0,e.vegaView=void 0},e.generateSpec=function(){var t,n,a=e.props,o=a.element,r=a.theme,i=JSON.parse(o.spec),s=o.useContainerWidth;if("streamlit"===o.vegaLiteTheme?i.config=S(i.config,r):"streamlit"===(null===(t=i.usermeta)||void 0===t||null===(n=t.embedOptions)||void 0===n?void 0:n.theme)?(i.config=S(i.config,r),i.usermeta.embedOptions.theme=void 0):i.config=F(i.config,r),e.props.height?(i.width=e.props.width,i.height=e.props.height):s&&(i.width=e.props.width),i.padding||(i.padding={}),null==i.padding.bottom&&(i.padding.bottom=20),i.datasets)throw new Error("Datasets should not be passed as part of the spec");return i},e}return(0,s.Z)(n,[{key:"componentDidMount",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.createView();case 3:e.next=9;break;case 5:e.prev=5,e.t0=e.catch(0),t=(0,v.b)(e.t0),this.setState({error:t});case 9:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(){return e.apply(this,arguments)}}()},{key:"componentWillUnmount",value:function(){this.finalizeView()}},{key:"componentDidUpdate",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(t){var n,r,i,s,l,d,c,u,h,g,f,p,b,w,y,x,S,F,k,z,C,V;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.element,r=t.theme,i=this.props,s=i.element,l=i.theme,d=n.spec,c=s.spec,this.vegaView&&d===c&&r===l&&t.width===this.props.width&&t.height===this.props.height&&t.element.vegaLiteTheme===this.props.element.vegaLiteTheme){e.next=16;break}return(0,m.ji)("Vega spec changed."),e.prev=6,e.next=9,this.createView();case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(6),u=(0,v.b)(e.t0),this.setState({error:u});case 15:return e.abrupt("return");case 16:for(h=n.data,g=s.data,(h||g)&&this.updateData(this.defaultDataName,h,g),f=I(n)||{},p=I(s)||{},b=0,w=Object.entries(p);b<w.length;b++)y=(0,a.Z)(w[b],2),x=y[0],S=y[1],F=x||this.defaultDataName,k=f[F],this.updateData(F,k,S);for(z=0,C=Object.keys(f);z<C.length;z++)V=C[z],p.hasOwnProperty(V)||V===this.defaultDataName||this.updateData(V,null,null);this.vegaView.resize().runAsync();case 24:case"end":return e.stop()}}),e,this,[[6,11]])})));return function(t){return e.apply(this,arguments)}}()},{key:"updateData",value:function(e,t,n){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(n&&0!==n.data.numRows)if(t&&0!==t.data.numRows){var a=t.dimensions,o=a.dataRows,r=a.dataColumns,i=n.dimensions,s=i.dataRows;if(function(e,t,n,a,o,r){if(n!==r)return!1;if(t>=o)return!1;if(0===t)return!1;var i=r-1,s=t-1;if(e.getDataValue(0,i)!==a.getDataValue(0,i)||e.getDataValue(s,i)!==a.getDataValue(s,i))return!1;return!0}(t,o,r,n,s,i.dataColumns))o<s&&this.vegaView.insert(e,T(n,o));else{var l=g.changeset().remove(g.truthy).insert(T(n));this.vegaView.change(e,l),(0,m.ji)("Had to clear the ".concat(e," dataset before inserting data through Vega view."))}}else this.vegaView.insert(e,T(n));else this.vegaView._runtime.data.hasOwnProperty(e)&&this.vegaView.remove(e,g.truthy)}},{key:"createView",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,n,r,i,s,l,d,c,u,g,p,v,b,w,y,x,S;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((0,m.ji)("Creating a new Vega view."),this.element){e.next=3;break}throw Error("Element missing.");case 3:return this.finalizeView(),t=this.props.element,n=this.generateSpec(),r={defaultStyle:!0,ast:!0,expr:f.N},e.next=9,(0,h.ZP)(this.element,n,r);case 9:if(i=e.sent,s=i.vgSpec,l=i.view,d=i.finalize,this.vegaView=l,this.vegaFinalizer=d,c=W(t),1===(u=c?Object.keys(c):[]).length?(g=(0,a.Z)(u,1),p=g[0],this.defaultDataName=p):0===u.length&&s.data&&(this.defaultDataName=V),(v=D(t))&&l.insert(this.defaultDataName,v),c)for(b=0,w=Object.entries(c);b<w.length;b++)y=(0,a.Z)(w[b],2),x=y[0],S=y[1],l.insert(x,S);return e.next=23,l.runAsync();case 23:this.vegaView.resize().runAsync();case 24:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this;if(this.state.error)throw this.state.error;return(0,z.jsx)(k,{"data-testid":"stArrowVegaLiteChart",ref:function(t){e.element=t}})}}]),n}(c.PureComponent);function D(e){var t=e.data;return t&&0!==t.data.numRows?T(t):null}function W(e){var t=I(e);if(null==t)return null;for(var n={},o=0,r=Object.entries(t);o<r.length;o++){var i=(0,a.Z)(r[o],2),s=i[0],l=i[1];n[s]=T(l)}return n}function I(e){var t;if(0===(null===(t=e.datasets)||void 0===t?void 0:t.length))return null;var n={};return e.datasets.forEach((function(e){if(e){var t=e.hasName?e.name:null;n[t]=e.data}})),n}function T(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e.isEmpty())return[];for(var n=[],a=e.dimensions,o=a.dataRows,r=a.dataColumns,i=b.fu.getTypeName(e.types.index[0]),s=P.has(i),l=t;l<o;l++){var d={};if(s){var c=e.getIndexValue(l,0);d[C]="bigint"===typeof c?Number(c):c}for(var u=0;u<r;u++){var h=e.getDataValue(l,u);d[e.columns[0][u]]="bigint"===typeof h?Number(h):h}n.push(d)}return n}var N=(0,u.b)((0,p.Z)(Z))}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[745],{6745:function(e,t,n){n.r(t),n.d(t,{default:function(){return N}});var a=n(29439),o=n(74165),r=n(15861),i=n(15671),s=n(43144),l=n(60136),d=n(29388),c=n(47313),u=n(83985),h=n(86538),g=n(61469),f=n(29334),m=n(72599),p=n(26419),v=n(81003),b=n(45429),w=n(1413),y=n(16031),x=n(81512);function S(e,t){var n={font:t.genericFonts.bodyFont,background:t.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:t.colors.headingColor,titleFontStyle:"normal",fontWeight:t.fontWeights.bold,fontSize:t.fontSizes.smPx+2,orient:"top",offset:26},axis:{labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,x.Xy)(t),labelFontStyle:"normal",titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.smPx,titleColor:(0,x.Xy)(t),titleFontStyle:"normal",ticks:!1,gridColor:(0,x.ny)(t),domain:!1,domainWidth:1,domainColor:(0,x.ny)(t),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:t.spacing.lgPx,labelPadding:t.spacing.lgPx,labelSeparation:t.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:t.fontSizes.smPx,labelFontWeight:t.fontWeights.normal,labelColor:(0,x.Xy)(t),titleFontSize:t.fontSizes.smPx,titleFontWeight:t.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,x.Xy)(t),titlePadding:t.spacing.mdPx,labelPadding:t.spacing.lgPx,columnPadding:t.spacing.smPx,rowPadding:t.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,x.iY)(t),diverging:(0,x.ru)(t),ramp:(0,x.Gy)(t),heatmap:(0,x.Gy)(t)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:(0,w.Z)({tooltip:!0},(0,x.Iy)(t)?{color:"#0068C9"}:{color:"#83C9FF"}),bar:{binSpacing:t.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return e?(0,y.mergeWith)({},n,e,(function(e,t){return(0,y.isArray)(t)?t:void 0})):n}function F(e,t){var n=t.colors,a=t.fontSizes,o=t.genericFonts,r={labelFont:o.bodyFont,titleFont:o.bodyFont,labelFontSize:a.twoSmPx,titleFontSize:a.twoSmPx},i={background:n.bgColor,axis:(0,w.Z)({labelColor:n.bodyText,titleColor:n.bodyText,gridColor:(0,x.ny)(t)},r),legend:(0,w.Z)({labelColor:n.bodyText,titleColor:n.bodyText},r),title:(0,w.Z)({color:n.bodyText,subtitleColor:n.bodyText},r),header:{labelColor:n.bodyText},view:{continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return e?(0,y.merge)({},i,e):i}var k=(0,n(47167).Z)("div",{target:"everg990"})((function(e){var t=e.theme;return{"&.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 ".concat(t.colors.fadedText10),a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:"".concat(t.spacing.twoXS," ").concat(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}}}}}),""),z=n(46417),C="(index)",V="source",P=new Set([b.GI.DatetimeIndex,b.GI.Float64Index,b.GI.Int64Index,b.GI.RangeIndex,b.GI.UInt64Index]),Z=function(e){(0,l.Z)(n,e);var t=(0,d.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return(e=t.call.apply(t,[this].concat(o))).vegaView=void 0,e.vegaFinalizer=void 0,e.defaultDataName=V,e.element=null,e.state={error:void 0},e.finalizeView=function(){e.vegaFinalizer&&e.vegaFinalizer(),e.vegaFinalizer=void 0,e.vegaView=void 0},e.generateSpec=function(){var t,n,a=e.props,o=a.element,r=a.theme,i=JSON.parse(o.spec),s=o.useContainerWidth;if("streamlit"===o.vegaLiteTheme?i.config=S(i.config,r):"streamlit"===(null===(t=i.usermeta)||void 0===t||null===(n=t.embedOptions)||void 0===n?void 0:n.theme)?(i.config=S(i.config,r),i.usermeta.embedOptions.theme=void 0):i.config=F(i.config,r),e.props.height?(i.width=e.props.width,i.height=e.props.height):s&&(i.width=e.props.width),i.padding||(i.padding={}),null==i.padding.bottom&&(i.padding.bottom=20),i.datasets)throw new Error("Datasets should not be passed as part of the spec");return i},e}return(0,s.Z)(n,[{key:"componentDidMount",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.createView();case 3:e.next=9;break;case 5:e.prev=5,e.t0=e.catch(0),t=(0,v.b)(e.t0),this.setState({error:t});case 9:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(){return e.apply(this,arguments)}}()},{key:"componentWillUnmount",value:function(){this.finalizeView()}},{key:"componentDidUpdate",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(t){var n,r,i,s,l,d,c,u,h,g,f,p,b,w,y,x,S,F,k,z,C,V;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.element,r=t.theme,i=this.props,s=i.element,l=i.theme,d=n.spec,c=s.spec,this.vegaView&&d===c&&r===l&&t.width===this.props.width&&t.height===this.props.height&&t.element.vegaLiteTheme===this.props.element.vegaLiteTheme){e.next=16;break}return(0,m.ji)("Vega spec changed."),e.prev=6,e.next=9,this.createView();case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(6),u=(0,v.b)(e.t0),this.setState({error:u});case 15:return e.abrupt("return");case 16:for(h=n.data,g=s.data,(h||g)&&this.updateData(this.defaultDataName,h,g),f=I(n)||{},p=I(s)||{},b=0,w=Object.entries(p);b<w.length;b++)y=(0,a.Z)(w[b],2),x=y[0],S=y[1],F=x||this.defaultDataName,k=f[F],this.updateData(F,k,S);for(z=0,C=Object.keys(f);z<C.length;z++)V=C[z],p.hasOwnProperty(V)||V===this.defaultDataName||this.updateData(V,null,null);this.vegaView.resize().runAsync();case 24:case"end":return e.stop()}}),e,this,[[6,11]])})));return function(t){return e.apply(this,arguments)}}()},{key:"updateData",value:function(e,t,n){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(n&&0!==n.data.numRows)if(t&&0!==t.data.numRows){var a=t.dimensions,o=a.dataRows,r=a.dataColumns,i=n.dimensions,s=i.dataRows;if(function(e,t,n,a,o,r){if(n!==r)return!1;if(t>=o)return!1;if(0===t)return!1;var i=r-1,s=t-1;if(e.getDataValue(0,i)!==a.getDataValue(0,i)||e.getDataValue(s,i)!==a.getDataValue(s,i))return!1;return!0}(t,o,r,n,s,i.dataColumns))o<s&&this.vegaView.insert(e,T(n,o));else{var l=g.changeset().remove(g.truthy).insert(T(n));this.vegaView.change(e,l),(0,m.ji)("Had to clear the ".concat(e," dataset before inserting data through Vega view."))}}else this.vegaView.insert(e,T(n));else this.vegaView._runtime.data.hasOwnProperty(e)&&this.vegaView.remove(e,g.truthy)}},{key:"createView",value:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,n,r,i,s,l,d,c,u,g,p,v,b,w,y,x,S;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((0,m.ji)("Creating a new Vega view."),this.element){e.next=3;break}throw Error("Element missing.");case 3:return this.finalizeView(),t=this.props.element,n=this.generateSpec(),r={defaultStyle:!0,ast:!0,expr:f.N},e.next=9,(0,h.ZP)(this.element,n,r);case 9:if(i=e.sent,s=i.vgSpec,l=i.view,d=i.finalize,this.vegaView=l,this.vegaFinalizer=d,c=W(t),1===(u=c?Object.keys(c):[]).length?(g=(0,a.Z)(u,1),p=g[0],this.defaultDataName=p):0===u.length&&s.data&&(this.defaultDataName=V),(v=D(t))&&l.insert(this.defaultDataName,v),c)for(b=0,w=Object.entries(c);b<w.length;b++)y=(0,a.Z)(w[b],2),x=y[0],S=y[1],l.insert(x,S);return e.next=23,l.runAsync();case 23:this.vegaView.resize().runAsync();case 24:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this;if(this.state.error)throw this.state.error;return(0,z.jsx)(k,{"data-testid":"stArrowVegaLiteChart",ref:function(t){e.element=t}})}}]),n}(c.PureComponent);function D(e){var t=e.data;return t&&0!==t.data.numRows?T(t):null}function W(e){var t=I(e);if(null==t)return null;for(var n={},o=0,r=Object.entries(t);o<r.length;o++){var i=(0,a.Z)(r[o],2),s=i[0],l=i[1];n[s]=T(l)}return n}function I(e){var t;if(0===(null===(t=e.datasets)||void 0===t?void 0:t.length))return null;var n={};return e.datasets.forEach((function(e){if(e){var t=e.hasName?e.name:null;n[t]=e.data}})),n}function T(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e.isEmpty())return[];for(var n=[],a=e.dimensions,o=a.dataRows,r=a.dataColumns,i=b.fu.getTypeName(e.types.index[0]),s=P.has(i),l=t;l<o;l++){var d={};if(s){var c=e.getIndexValue(l,0);d[C]="bigint"===typeof c?Number(c):c}for(var u=0;u<r;u++){var h=e.getDataValue(l,u);d[e.columns[0][u]]="bigint"===typeof h?Number(h):h}n.push(d)}return n}var N=(0,u.b)((0,p.Z)(Z))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[807],{99807:function(n,r,o){o.r(r),o.d(r,{default:function(){return c}});o(47313);var t=o(4371),i=o(47167),e=o(16168),a=(0,i.Z)("div",{target:"edb2rvg0"})((function(n){var r=n.theme;return{paddingBottom:r.spacing.smPx,lineHeight:r.lineHeights.normal,color:(0,e.yq)(r)}}),""),s=o(50412),g=o(46417);var c=function(n){var r=n.element,o=n.width;return(0,g.jsxs)("div",{className:"stProgress",children:[(0,g.jsx)(a,{children:(0,g.jsx)(s.Z,{source:r.text,allowHTML:!1,isLabel:!0})}),(0,g.jsx)(t.Z,{value:r.value,width:o})]})}},4371:function(n,r,o){o.d(r,{$:function(){return t},Z:function(){return d}});var t,i=o(47313),e=o(83985),a=o(54922),s=o(16168),g=o(75314),c=o(74969),u=o(46417);!function(n){n.EXTRASMALL="xs",n.SMALL="sm",n.MEDIUM="md",n.LARGE="lg",n.EXTRALARGE="xl"}(t||(t={}));var d=function(n){var r=n.value,o=n.width,d=n.size,l=void 0===d?t.SMALL:d,p=n.overrides,m=(0,e.u)(),h={xs:m.spacing.twoXS,sm:m.spacing.sm,md:m.spacing.lg,lg:m.spacing.xl,xl:m.spacing.twoXL},f=i.useContext(a.I).activeTheme,v=!(0,s.MJ)(f),w={BarContainer:{style:{marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none}},Bar:{style:function(n){var r=n.$theme;return{width:o?o.toString():void 0,marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none,height:h[l],backgroundColor:r.colors.progressbarTrackFill,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?m.colors.primary:m.colors.blue70,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}}};return(0,u.jsx)(g.Z,{value:r,overrides:(0,c.aO)(w,p)})}}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[807],{99807:function(n,r,o){o.r(r),o.d(r,{default:function(){return c}});o(47313);var t=o(4371),i=o(47167),e=o(81512),a=(0,i.Z)("div",{target:"edb2rvg0"})((function(n){var r=n.theme;return{paddingBottom:r.spacing.smPx,lineHeight:r.lineHeights.normal,color:(0,e.yq)(r)}}),""),s=o(50412),g=o(46417);var c=function(n){var r=n.element,o=n.width;return(0,g.jsxs)("div",{className:"stProgress",children:[(0,g.jsx)(a,{children:(0,g.jsx)(s.Z,{source:r.text,allowHTML:!1,isLabel:!0})}),(0,g.jsx)(t.Z,{value:r.value,width:o})]})}},4371:function(n,r,o){o.d(r,{$:function(){return t},Z:function(){return d}});var t,i=o(47313),e=o(83985),a=o(54922),s=o(81512),g=o(75314),c=o(74969),u=o(46417);!function(n){n.EXTRASMALL="xs",n.SMALL="sm",n.MEDIUM="md",n.LARGE="lg",n.EXTRALARGE="xl"}(t||(t={}));var d=function(n){var r=n.value,o=n.width,d=n.size,l=void 0===d?t.SMALL:d,p=n.overrides,m=(0,e.u)(),h={xs:m.spacing.twoXS,sm:m.spacing.sm,md:m.spacing.lg,lg:m.spacing.xl,xl:m.spacing.twoXL},f=i.useContext(a.I).activeTheme,v=!(0,s.MJ)(f),w={BarContainer:{style:{marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none}},Bar:{style:function(n){var r=n.$theme;return{width:o?o.toString():void 0,marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none,height:h[l],backgroundColor:r.colors.progressbarTrackFill,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?m.colors.primary:m.colors.blue70,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}}};return(0,u.jsx)(g.Z,{value:r,overrides:(0,c.aO)(w,p)})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[828],{2828:function(e,t,n){n.r(t),n.d(t,{default:function(){return w}});var r=n(15671),a=n(43144),i=n(60136),o=n(29388),s=n(47313),l=n(70816),u=n.n(l),p=n(83985),d=n(78138),m=n(66097),c=n(18550),f=n(46332),h=n(65167),g=n(73290),y=n(80213),v=n(64243),b=n(46417),C="YYYY/MM/DD";function x(e){return e.map((function(e){return new Date(e)}))}function k(e){return e.map((function(e){return u()(e).format(C)}))}var V=function(e){(0,i.Z)(n,e);var t=(0,o.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new f.Kz,e.state={values:e.initialValue,isRange:e.props.element.isRange,isEmpty:!1},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringArrayValue(e.props.element,k(e.state.values),t)},e.onFormCleared=function(){var t=x(e.props.element.default);e.setState({values:t},(function(){return e.commitWidgetValue({fromUi:!0})}))},e.handleChange=function(t){var n=t.date;if(null!==n&&void 0!==n){var r=[];Array.isArray(n)?n.forEach((function(e){e&&r.push(e)})):r.push(n),e.setState({values:r,isEmpty:!r},(function(){e.state.isEmpty||e.commitWidgetValue({fromUi:!0})}))}else e.setState({values:[],isEmpty:!0})},e.handleClose=function(){e.state.isEmpty&&e.setState((function(e,t){return{values:x(t.element.default),isEmpty:!x(t.element.default)}}),(function(){e.commitWidgetValue({fromUi:!0})}))},e.getMaxDate=function(){var t=e.props.element.max;return t&&t.length>0?u()(t,C).toDate():void 0},e}return(0,a.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringArrayValue(this.props.element);return x(void 0!==e?e:this.props.element.default)}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({values:t.map((function(e){return new Date(e)}))},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,n=t.width,r=t.element,a=t.disabled,i=t.theme,o=t.widgetMgr,s=this.state,l=s.values,p=s.isRange,f=i.colors,x=i.fontSizes,k=i.lineHeights,V={width:n},w=u()(r.min,C).toDate(),D=this.getMaxDate();return this.formClearHelper.manageFormClearListener(o,r.formId,this.onFormCleared),(0,b.jsxs)("div",{className:"stDateInput",style:V,children:[(0,b.jsx)(h.ON,{label:r.label,disabled:a,labelVisibility:(0,v.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:r.help&&(0,b.jsx)(h.dT,{children:(0,b.jsx)(g.ZP,{content:r.help,placement:y.ug.TOP_RIGHT})})}),(0,b.jsx)(d.Z,{density:m.pw.high,formatString:"yyyy/MM/dd",disabled:a,onChange:this.handleChange,onClose:this.handleClose,overrides:{Popover:{props:{placement:c.r4.bottomLeft,overrides:{Body:{style:{border:"1px solid ".concat(f.fadedText10)}}}}},CalendarContainer:{style:{fontSize:x.sm,paddingRight:i.spacing.sm,paddingLeft:i.spacing.sm,paddingBottom:i.spacing.sm,paddingTop:i.spacing.sm}},Week:{style:{fontSize:x.sm}},Day:{style:{fontSize:x.sm,lineHeight:k.base,"::after":{borderColor:f.transparent}}},PrevButton:{style:function(){return{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:f.transparent},":focus":{backgroundColor:f.transparent,outline:0}}}},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:f.transparent},":focus":{backgroundColor:f.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:l,minDate:w,maxDate:D,range:p})]})}}]),n}(s.PureComponent),w=(0,p.b)(V)}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[828],{2828:function(e,t,n){n.r(t),n.d(t,{default:function(){return w}});var r=n(15671),a=n(43144),i=n(60136),o=n(29388),s=n(47313),l=n(70816),u=n.n(l),p=n(83985),d=n(78138),m=n(66097),c=n(18550),f=n(46332),h=n(65167),g=n(73290),y=n(10612),v=n(64243),b=n(46417),C="YYYY/MM/DD";function x(e){return e.map((function(e){return new Date(e)}))}function k(e){return e.map((function(e){return u()(e).format(C)}))}var V=function(e){(0,i.Z)(n,e);var t=(0,o.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new f.Kz,e.state={values:e.initialValue,isRange:e.props.element.isRange,isEmpty:!1},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringArrayValue(e.props.element,k(e.state.values),t)},e.onFormCleared=function(){var t=x(e.props.element.default);e.setState({values:t},(function(){return e.commitWidgetValue({fromUi:!0})}))},e.handleChange=function(t){var n=t.date;if(null!==n&&void 0!==n){var r=[];Array.isArray(n)?n.forEach((function(e){e&&r.push(e)})):r.push(n),e.setState({values:r,isEmpty:!r},(function(){e.state.isEmpty||e.commitWidgetValue({fromUi:!0})}))}else e.setState({values:[],isEmpty:!0})},e.handleClose=function(){e.state.isEmpty&&e.setState((function(e,t){return{values:x(t.element.default),isEmpty:!x(t.element.default)}}),(function(){e.commitWidgetValue({fromUi:!0})}))},e.getMaxDate=function(){var t=e.props.element.max;return t&&t.length>0?u()(t,C).toDate():void 0},e}return(0,a.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringArrayValue(this.props.element);return x(void 0!==e?e:this.props.element.default)}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({values:t.map((function(e){return new Date(e)}))},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,n=t.width,r=t.element,a=t.disabled,i=t.theme,o=t.widgetMgr,s=this.state,l=s.values,p=s.isRange,f=i.colors,x=i.fontSizes,k=i.lineHeights,V={width:n},w=u()(r.min,C).toDate(),D=this.getMaxDate();return this.formClearHelper.manageFormClearListener(o,r.formId,this.onFormCleared),(0,b.jsxs)("div",{className:"stDateInput",style:V,children:[(0,b.jsx)(h.ON,{label:r.label,disabled:a,labelVisibility:(0,v.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:r.help&&(0,b.jsx)(h.dT,{children:(0,b.jsx)(g.ZP,{content:r.help,placement:y.ug.TOP_RIGHT})})}),(0,b.jsx)(d.Z,{density:m.pw.high,formatString:"yyyy/MM/dd",disabled:a,onChange:this.handleChange,onClose:this.handleClose,overrides:{Popover:{props:{placement:c.r4.bottomLeft,overrides:{Body:{style:{border:"1px solid ".concat(f.fadedText10)}}}}},CalendarContainer:{style:{fontSize:x.sm,paddingRight:i.spacing.sm,paddingLeft:i.spacing.sm,paddingBottom:i.spacing.sm,paddingTop:i.spacing.sm}},Week:{style:{fontSize:x.sm}},Day:{style:{fontSize:x.sm,lineHeight:k.base,"::after":{borderColor:f.transparent}}},PrevButton:{style:function(){return{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:f.transparent},":focus":{backgroundColor:f.transparent,outline:0}}}},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:f.transparent},":focus":{backgroundColor:f.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:l,minDate:w,maxDate:D,range:p})]})}}]),n}(s.PureComponent),w=(0,p.b)(V)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[871],{75006:function(e,t,n){n.d(t,{Z:function(){return m}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),s=n(30168),l=n(47167),u=(0,n(30686).F4)(r||(r=(0,s.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(u),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),d=n(46417),m=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,s=e.type,l=[],u=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,d.jsx)(c,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===s?"single":s)?(0,o.Ge)()?u("Press \u2318+Enter to apply"):u("Press Ctrl+Enter to apply"):u("Press Enter to apply")),r&&u("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,d.jsx)(i.X7,{className:a,children:l})}},92871:function(e,t,n){n.r(t),n.d(t,{default:function(){return j}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),s=n(47313),l=n(66946),u=n(99055),c=n(17076),d=n(46332),m=n(72599),p=n(7976),f=n(73290),h=n(80213),g=n(49089),b=n(3208),y=n(75006),v=n(65167),x=n(64243),w=n(47167);var V=(0,w.Z)("div",{target:"e1jwn65y3"})((function(e){var t=e.theme;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",borderWidth:"1px",borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.md,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),k=(0,w.Z)("div",{target:"e1jwn65y2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),C=(0,w.Z)("button",{target:"e1jwn65y1"})((function(e){var t=e.theme;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"".concat(32,"px"),justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.md,borderBottomRightRadius:t.radii.md},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),D=(0,w.Z)("div",{target:"e1jwn65y0"})((function(e){return{position:"absolute",marginRight:e.theme.spacing.twoXS,left:0,right:"".concat(64,"px")}}),""),R=n(46417);var j=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(e){var o;return(0,r.Z)(this,n),(o=t.call(this,e)).formClearHelper=new d.Kz,o.inputRef=s.createRef(),o.formatValue=function(e){var t=function(e){return null==e||""===e?void 0:e}(o.props.element.format);if(null==t)return e.toString();try{return(0,c.sprintf)(t,e)}catch(n){return(0,m.KE)("Error in sprintf(".concat(t,", ").concat(e,"): ").concat(n)),String(e)}},o.isIntData=function(){return o.props.element.dataType===p.Y2.DataType.INT},o.getMin=function(){return o.props.element.hasMin?o.props.element.min:-1/0},o.getMax=function(){return o.props.element.hasMax?o.props.element.max:1/0},o.getStep=function(){var e=o.props.element.step;return e||(o.isIntData()?1:.01)},o.commitWidgetValue=function(e){var t=o.state.value,n=o.props,r=n.element,i=n.widgetMgr,a=o.props.element,s=o.getMin(),l=o.getMax();if(s>t||t>l){var u=o.inputRef.current;u&&u.reportValidity()}else{var c=t||0===t?t:a.default;o.isIntData()?i.setIntValue(r,c,e):i.setDoubleValue(r,c,e),o.setState({dirty:!1,value:c,formattedValue:o.formatValue(c)})}},o.onFormCleared=function(){o.setState((function(e,t){return{value:t.element.default}}),(function(){return o.commitWidgetValue({fromUi:!0})}))},o.onBlur=function(){o.state.dirty&&o.commitWidgetValue({fromUi:!0}),o.setState({isFocused:!1})},o.onFocus=function(){o.setState({isFocused:!0})},o.onChange=function(e){var t,n=e.target.value;t=o.isIntData()?parseInt(n,10):parseFloat(n),o.setState({dirty:!0,value:t,formattedValue:n})},o.onKeyDown=function(e){switch(e.key){case"ArrowUp":e.preventDefault(),o.modifyValueUsingStep("increment")();break;case"ArrowDown":e.preventDefault(),o.modifyValueUsingStep("decrement")()}},o.onKeyPress=function(e){"Enter"===e.key&&o.state.dirty&&o.commitWidgetValue({fromUi:!0})},o.modifyValueUsingStep=function(e){return function(){var t=o.state.value,n=o.getStep();switch(e){case"increment":o.canIncrement&&o.setState({dirty:!0,value:t+n},(function(){o.commitWidgetValue({fromUi:!0})}));break;case"decrement":o.canDecrement&&o.setState({dirty:!0,value:t-n},(function(){o.commitWidgetValue({fromUi:!0})}))}}},o.state={dirty:!1,value:o.initialValue,formattedValue:o.formatValue(o.initialValue),isFocused:!1},o}return(0,o.Z)(n,[{key:"initialValue",get:function(){var 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}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t,formattedValue:this.formatValue(t)},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"canDecrement",get:function(){return this.state.value-this.getStep()>=this.getMin()}},{key:"canIncrement",get:function(){return this.state.value+this.getStep()<=this.getMax()}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.width,o=t.disabled,i=t.widgetMgr,a=this.state,s=a.formattedValue,c=a.dirty,d=a.isFocused,m={width:r},p=!this.canDecrement||o,w=!this.canIncrement||o;return this.formClearHelper.manageFormClearListener(i,n.formId,this.onFormCleared),(0,R.jsxs)("div",{className:"stNumberInput",style:m,children:[(0,R.jsx)(v.ON,{label:n.label,disabled:o,labelVisibility:(0,x.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,R.jsx)(v.dT,{children:(0,R.jsx)(f.ZP,{content:n.help,placement:h.ug.TOP_RIGHT})})}),(0,R.jsxs)(V,{className:d?"focused":"",children:[(0,R.jsx)(b.Z,{type:"number",inputRef:this.inputRef,value:s,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,disabled:o,"aria-label":n.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:function(){return{borderTopRightRadius:0,borderBottomRightRadius:0}}},Root:{style:function(){return{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0}}}}}),(0,R.jsxs)(k,{children:[(0,R.jsx)(C,{className:"step-down",onClick:this.modifyValueUsingStep("decrement"),disabled:p,children:(0,R.jsx)(g.ZP,{content:l.W,size:"xs",color:this.canDecrement?"inherit":"disabled"})}),(0,R.jsx)(C,{className:"step-up",onClick:this.modifyValueUsingStep("increment"),disabled:w,children:(0,R.jsx)(g.ZP,{content:u.v,size:"xs",color:this.canIncrement?"inherit":"disabled"})})]})]}),(0,R.jsx)(D,{children:(0,R.jsx)(y.Z,{dirty:c,value:s,className:"input-instructions"})})]})}}]),n}(s.PureComponent)}}]);
1
+ "use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[871],{75006:function(e,t,n){n.d(t,{Z:function(){return m}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),s=n(30168),l=n(47167),u=(0,n(30686).F4)(r||(r=(0,s.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(u),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),d=n(46417),m=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,s=e.type,l=[],u=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,d.jsx)(c,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===s?"single":s)?(0,o.Ge)()?u("Press \u2318+Enter to apply"):u("Press Ctrl+Enter to apply"):u("Press Enter to apply")),r&&u("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,d.jsx)(i.X7,{className:a,children:l})}},92871:function(e,t,n){n.r(t),n.d(t,{default:function(){return j}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),s=n(47313),l=n(66946),u=n(99055),c=n(17076),d=n(46332),m=n(72599),p=n(7976),f=n(73290),h=n(10612),g=n(49089),b=n(3208),y=n(75006),v=n(65167),x=n(64243),w=n(47167);var V=(0,w.Z)("div",{target:"e1jwn65y3"})((function(e){var t=e.theme;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",borderWidth:"1px",borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.md,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),k=(0,w.Z)("div",{target:"e1jwn65y2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),C=(0,w.Z)("button",{target:"e1jwn65y1"})((function(e){var t=e.theme;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"".concat(32,"px"),justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.md,borderBottomRightRadius:t.radii.md},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),D=(0,w.Z)("div",{target:"e1jwn65y0"})((function(e){return{position:"absolute",marginRight:e.theme.spacing.twoXS,left:0,right:"".concat(64,"px")}}),""),R=n(46417);var j=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(e){var o;return(0,r.Z)(this,n),(o=t.call(this,e)).formClearHelper=new d.Kz,o.inputRef=s.createRef(),o.formatValue=function(e){var t=function(e){return null==e||""===e?void 0:e}(o.props.element.format);if(null==t)return e.toString();try{return(0,c.sprintf)(t,e)}catch(n){return(0,m.KE)("Error in sprintf(".concat(t,", ").concat(e,"): ").concat(n)),String(e)}},o.isIntData=function(){return o.props.element.dataType===p.Y2.DataType.INT},o.getMin=function(){return o.props.element.hasMin?o.props.element.min:-1/0},o.getMax=function(){return o.props.element.hasMax?o.props.element.max:1/0},o.getStep=function(){var e=o.props.element.step;return e||(o.isIntData()?1:.01)},o.commitWidgetValue=function(e){var t=o.state.value,n=o.props,r=n.element,i=n.widgetMgr,a=o.props.element,s=o.getMin(),l=o.getMax();if(s>t||t>l){var u=o.inputRef.current;u&&u.reportValidity()}else{var c=t||0===t?t:a.default;o.isIntData()?i.setIntValue(r,c,e):i.setDoubleValue(r,c,e),o.setState({dirty:!1,value:c,formattedValue:o.formatValue(c)})}},o.onFormCleared=function(){o.setState((function(e,t){return{value:t.element.default}}),(function(){return o.commitWidgetValue({fromUi:!0})}))},o.onBlur=function(){o.state.dirty&&o.commitWidgetValue({fromUi:!0}),o.setState({isFocused:!1})},o.onFocus=function(){o.setState({isFocused:!0})},o.onChange=function(e){var t,n=e.target.value;t=o.isIntData()?parseInt(n,10):parseFloat(n),o.setState({dirty:!0,value:t,formattedValue:n})},o.onKeyDown=function(e){switch(e.key){case"ArrowUp":e.preventDefault(),o.modifyValueUsingStep("increment")();break;case"ArrowDown":e.preventDefault(),o.modifyValueUsingStep("decrement")()}},o.onKeyPress=function(e){"Enter"===e.key&&o.state.dirty&&o.commitWidgetValue({fromUi:!0})},o.modifyValueUsingStep=function(e){return function(){var t=o.state.value,n=o.getStep();switch(e){case"increment":o.canIncrement&&o.setState({dirty:!0,value:t+n},(function(){o.commitWidgetValue({fromUi:!0})}));break;case"decrement":o.canDecrement&&o.setState({dirty:!0,value:t-n},(function(){o.commitWidgetValue({fromUi:!0})}))}}},o.state={dirty:!1,value:o.initialValue,formattedValue:o.formatValue(o.initialValue),isFocused:!1},o}return(0,o.Z)(n,[{key:"initialValue",get:function(){var 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}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t,formattedValue:this.formatValue(t)},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"canDecrement",get:function(){return this.state.value-this.getStep()>=this.getMin()}},{key:"canIncrement",get:function(){return this.state.value+this.getStep()<=this.getMax()}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.width,o=t.disabled,i=t.widgetMgr,a=this.state,s=a.formattedValue,c=a.dirty,d=a.isFocused,m={width:r},p=!this.canDecrement||o,w=!this.canIncrement||o;return this.formClearHelper.manageFormClearListener(i,n.formId,this.onFormCleared),(0,R.jsxs)("div",{className:"stNumberInput",style:m,children:[(0,R.jsx)(v.ON,{label:n.label,disabled:o,labelVisibility:(0,x.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,R.jsx)(v.dT,{children:(0,R.jsx)(f.ZP,{content:n.help,placement:h.ug.TOP_RIGHT})})}),(0,R.jsxs)(V,{className:d?"focused":"",children:[(0,R.jsx)(b.Z,{type:"number",inputRef:this.inputRef,value:s,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,disabled:o,"aria-label":n.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:function(){return{borderTopRightRadius:0,borderBottomRightRadius:0}}},Root:{style:function(){return{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0}}}}}),(0,R.jsxs)(k,{children:[(0,R.jsx)(C,{className:"step-down",onClick:this.modifyValueUsingStep("decrement"),disabled:p,children:(0,R.jsx)(g.ZP,{content:l.W,size:"xs",color:this.canDecrement?"inherit":"disabled"})}),(0,R.jsx)(C,{className:"step-up",onClick:this.modifyValueUsingStep("increment"),disabled:w,children:(0,R.jsx)(g.ZP,{content:u.v,size:"xs",color:this.canIncrement?"inherit":"disabled"})})]})]}),(0,R.jsx)(D,{children:(0,R.jsx)(y.Z,{dirty:c,value:s,className:"input-instructions"})})]})}}]),n}(s.PureComponent)}}]);