1"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4666],{90186:function(e,t,n){n.d(t,{$:function(){return i}});var i,r=n(66845),a=n(25621),s=n(66694),o=n(95118),l=n(38570),d=n(80318),c=n(40864);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(i||(i={})),t.Z=function(e){var t=e.value,n=e.width,u=e.size,p=void 0===u?i.SMALL:u,g=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.E).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[p],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,c.jsx)(l.Z,{value:t,overrides:(0,d.aO)(x,g)})}},77367:function(e,t,n){n.d(t,{R:function(){return a}});var i=n(22951),r=n(91976),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}()},14666:function(e,t,n){n.r(t),n.d(t,{default:function(){return be}});var i,r=n(649),a=n(22951),s=n(91976),o=n(67591),l=n(94337),d=n(45960),c=n.n(d),u=n(72706),p=n.n(u),g=n(66845),f=n(16295),m=n(87814),h=n(50641);!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],w=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);return a&&t>v/2?e(t/v,x[a-1],r):"".concat(t.toFixed(r)).concat(n.toUpperCase())},y=n(98478),b=n(86659),S=n(8879),F=n(68411),Z=n(50189),j=n(51622),I=n(9003),M=n(81354),z=n(64649),L=n(1515);var k=(0,L.Z)("section",{target:"e1b2p2ww15"})((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.lg,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(n.colors.primary)},color:t?n.colors.gray:n.colors.bodyText}}),""),B=(0,L.Z)("div",{target:"e1b2p2ww14"})((function(){return{marginRight:"auto",alignItems:"center",display:"flex"}}),""),C=(0,L.Z)("span",{target:"e1b2p2ww13"})((function(e){var t=e.theme;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),R=(0,L.Z)("span",{target:"e1b2p2ww12"})((function(e){return{marginBottom:e.theme.spacing.twoXS}}),""),U=(0,L.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),T=(0,L.Z)("div",{target:"e1b2p2ww10"})((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}}),""),X=(0,L.Z)("ul",{target:"e1b2p2ww9"})((function(){return{listStyleType:"none",marginBottom:0}}),""),E=(0,L.Z)("li",{target:"e1b2p2ww8"})((function(e){var t=e.theme;return{margin:t.spacing.none,padding:t.spacing.none}}),""),A=(0,L.Z)("div",{target:"e1b2p2ww7"})((function(e){return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.theme.spacing.lg,overflow:"hidden"}}),""),D=(0,L.Z)("div",{target:"e1b2p2ww6"})((function(e){var t=e.theme;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),P=(0,L.Z)("div",{target:"e1b2p2ww5"})((function(e){return{display:"flex",alignItems:"center",marginBottom:e.theme.spacing.twoXS}}),""),N=(0,L.Z)("span",{target:"e1b2p2ww4"})((function(e){return{marginRight:e.theme.spacing.twoXS}}),""),V=(0,L.Z)("div",{target:"e1b2p2ww3"})((function(e){var t=e.theme;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),W=(0,L.Z)("small",{target:"e1b2p2ww2"})((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,L.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),H=function(e){var t;return t={},(0,z.Z)(t,k,{display:"flex",flexDirection:"column",alignItems:"flex-start"}),(0,z.Z)(t,B,{marginBottom:e.spacing.lg}),(0,z.Z)(t,C,{display:"none"}),(0,z.Z)(t,T,{paddingRight:e.spacing.lg}),(0,z.Z)(t,P,{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm}),(0,z.Z)(t,D,{width:e.sizes.full}),(0,z.Z)(t,A,{flexDirection:"column"}),(0,z.Z)(t,W,{height:"auto",whiteSpace:"initial"}),(0,z.Z)(t,O,{display:"none"}),(0,z.Z)(t,E,{margin:e.spacing.none,padding:e.spacing.none}),t},_=(0,L.Z)("div",{target:"e1b2p2ww0"})((function(e){var t=e.theme;return t.inSidebar?H(t):(0,z.Z)({},"@media (max-width: ".concat(t.breakpoints.sm,")"),H(t))}),""),G=n(74529),K=n(46927),$=n(33746),q=n(40864),J=function(e){var t=e.multiple,n=e.acceptedExtensions,r=e.maxSizeBytes;return(0,q.jsxs)(B,{children:[(0,q.jsx)(C,{children:(0,q.jsx)(K.Z,{content:G.n,size:"threeXL"})}),(0,q.jsxs)(U,{children:[(0,q.jsxs)(R,{children:["Drag and drop file",t?"s":""," here"]}),(0,q.jsxs)($.x,{children:["Limit ".concat(w(r,i.Byte,0)," per file"),n.length?" \u2022 ".concat(n.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},Y=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)(j.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)(k,(0,Z.Z)((0,Z.Z)({},t()),{},{"data-testid":"stFileUploadDropzone",isDisabled:a,"aria-label":s,children:[(0,q.jsx)("input",(0,Z.Z)({},o())),(0,q.jsx)(J,{multiple:n,acceptedExtensions:i,maxSizeBytes:r}),(0,q.jsx)(I.ZP,{kind:M.nW.SECONDARY,disabled:a,size:M.V5.SMALL,children:"Browse files"})]}))}})},Q=n(11026),ee=n(53782),te=n(13005),ne=n.n(te),ie=n(30351),re=n(14
1609),ae=(0,L.Z)("div",{target:"e16k0npc1"})((function(e){var t=e.theme;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),se=(0,L.Z)("div",{target:"e16k0npc0"})((function(e){return{display:"flex",alignItems:"center",justifyContent:"center",color:e.theme.colors.fadedText40}}),""),oe=function(e){var t=e.className,n=e.currentPage,i=e.totalPages,r=e.onNext,a=e.onPrevious;return(0,q.jsxs)(ae,{className:t,children:[(0,q.jsx)($.x,{children:"Showing page ".concat(n," of ").concat(i)}),(0,q.jsxs)(se,{children:[(0,q.jsx)(I.ZP,{onClick:a,kind:M.nW.MINIMAL,children:(0,q.jsx)(K.Z,{content:ie.s,size:"xl"})}),(0,q.jsx)(I.ZP,{onClick:r,kind:M.nW.MINIMAL,children:(0,q.jsx)(K.Z,{content:re._,size:"xl"})})]})]})},le=n(88235),de=["pageSize","items","resetOnAdd"],ce=function(e,t){return Math.ceil(e.length/t)},ue=function(e){return ne()((function(t){var n=t.pageSize,i=t.items,r=t.resetOnAdd,a=(0,ee.Z)(t,de),s=(0,g.useState)(0),o=(0,Q.Z)(s,2),l=o[0],d=o[1],c=(0,g.useState)(ce(i,n)),u=(0,Q.Z)(c,2),p=u[0],f=u[1],m=(0,le.D)(i);(0,g.useEffect)((function(){m&&m.length!==i.length&&f(ce(i,n)),m&&m.length<i.length?r&&d(0):l+1>=p&&d(p-1)}),[i,l,n,m,r,p]);var h=i.slice(l*n,l*n+n);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(e,(0,Z.Z)({items:h},a)),i.length>n?(0,q.jsx)(oe,{className:"streamlit-paginator",pageSize:n,totalPages:p,currentPage:l+1,onNext:function(){d(Math.min(l+1,p-1))},onPrevious:function(){d(Math.max(0,l-1))}}):null]})}),e)},pe=n(62288),ge=n(87847),fe=n(31197),me=n(90186),he=function(e){var t=e.fileInfo;return"uploading"===t.status.type?(0,q.jsx)(me.Z,{value:t.status.progress,size:me.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,q.jsxs)(W,{children:[(0,q.jsx)(N,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,q.jsx)(O,{children:(0,q.jsx)(K.Z,{content:pe.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,q.jsx)($.x,{children:w(t.size,i.Byte)}):null},ve=function(e){var t=e.fileInfo,n=e.onDelete;return(0,q.jsxs)(P,{className:"uploadedFile",children:[(0,q.jsx)(V,{children:(0,q.jsx)(K.Z,{content:ge.h,size:"twoXL"})}),(0,q.jsxs)(A,{className:"uploadedFileData",children:[(0,q.jsx)(D,{className:"uploadedFileName",title:t.name,children:t.name}),(0,q.jsx)(he,{fileInfo:t})]}),(0,q.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,q.jsx)(I.ZP,{onClick:function(){return n(t.id)},kind:M.nW.MINIMAL,children:(0,q.jsx)(K.Z,{content:fe.U,size:"lg"})})})]})},xe=ue((function(e){var t=e.items,n=e.onDelete;return(0,q.jsx)(X,{children:t.map((function(e){return(0,q.jsx)(E,{children:(0,q.jsx)(ve,{fileInfo:e,onDelete:n})},e.id)}))})})),we=function(e){return(0,q.jsx)(T,{children:(0,q.jsx)(xe,(0,Z.Z)({},e))})},ye=n(77367),be=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.K,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);p().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 ye.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=c().CancelToken.source(),n=new ye.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){c().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(w(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);
1n.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 ye.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)(_,{"data-testid":"stFileUploader",children:[(0,q.jsx)(y.O,{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)(b.dT,{children:(0,q.jsx)(S.Z,{content:i.help,placement:F.u.TOP_RIGHT})})}),(0,q.jsx)(Y,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:s,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:r}),o.length>0&&(0,q.jsx)(we,{items:o,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(g.PureComponent)},87814:function(e,t,n){n.d(t,{K:function(){return s}});var i=n(22951),r=n(91976),a=n(50641),s=function(){function e(){(0,i.Z)(this,e),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}return(0,r.Z)(e,[{key:"manageFormClearListener",value:function(e,t,n){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,a.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,n),this.lastWidgetMgr=e,this.lastFormId=t))}},{key:"disconnect",value:function(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}]),e}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.