streamlit-nightly 1.41.2.dev20250122__py2.py3-none-any.whl → 1.41.2.dev20250123__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.
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.B5oak9Ia.js → FileDownload.esm.t1Hil-y4.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DPFVZXH5.js → FormClearHelper.rBcBHx-q.js} +1 -1
- streamlit/static/static/js/{Hooks.FlVdDTii.js → Hooks.B8TnuVtR.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BdYrHlrF.js → InputInstructions.CopSVRMj.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DGXb6QOO.js → ProgressBar.CH2O9ehW.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.DON4V-QO.js → RenderInPortalIfExists.MRfetJYl.js} +1 -1
- streamlit/static/static/js/{Toolbar.CLiZhV_n.js → Toolbar.CDCMZRKs.js} +1 -1
- streamlit/static/static/js/{base-input.DXAKraS2.js → base-input.D6xvdW3E.js} +1 -1
- streamlit/static/static/js/{createSuper.D3jRSoi-.js → createSuper.DoZ28Bia.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.XiPt9jLK.js → data-grid-overlay-editor.DXCddEab.js} +1 -1
- streamlit/static/static/js/{downloader.CGTT4RY7.js → downloader.C0cVY44J.js} +1 -1
- streamlit/static/static/js/{es6.CDFMHaCm.js → es6.BLqxZgqS.js} +2 -2
- streamlit/static/static/js/{getPrototypeOf.IRomgPPd.js → getPrototypeOf.kzwmebxc.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.CX6Wwtuu.js → iframeResizer.contentWindow.DD6xL-U3.js} +1 -1
- streamlit/static/static/js/{index.Dn7UmyWt.js → index.2GeiiWrC.js} +1 -1
- streamlit/static/static/js/{index.CzxmEs9w.js → index.8xFDRnWS.js} +1 -1
- streamlit/static/static/js/{index.BPivlwOm.js → index.B1sQCRIs.js} +1 -1
- streamlit/static/static/js/{index.rmAI4WPp.js → index.B7TeUVfZ.js} +1 -1
- streamlit/static/static/js/{index.B9-Y-BaD.js → index.BXD6MmFg.js} +1 -1
- streamlit/static/static/js/{index.CUZhGVfE.js → index.B_czjYL4.js} +5 -5
- streamlit/static/static/js/{index.BIUi0PJE.js → index.Bbg2PQIH.js} +1 -1
- streamlit/static/static/js/{index.ChXuNNZF.js → index.BcaoSc9o.js} +11 -11
- streamlit/static/static/js/{index.CyDO0RFh.js → index.BgLhUQOc.js} +1 -1
- streamlit/static/static/js/{index.C8iea7ju.js → index.BiBAL3w8.js} +1 -1
- streamlit/static/static/js/{index.Ld6ZhSbF.js → index.BiI5Rn5J.js} +1 -1
- streamlit/static/static/js/{index.lKc9LHL6.js → index.C5Aw0Bsm.js} +1 -1
- streamlit/static/static/js/{index.B_Ox2Ter.js → index.CBPL_Qdc.js} +1 -1
- streamlit/static/static/js/{index.BxUEHjBi.js → index.CC_Xa8j8.js} +1 -1
- streamlit/static/static/js/{index.Ba40Nozz.js → index.CDOn4Mmb.js} +1 -1
- streamlit/static/static/js/{index.CHOk0J7Q.js → index.CGJeU1TE.js} +1 -1
- streamlit/static/static/js/{index.C5QDcDeL.js → index.C_RLZUid.js} +1 -1
- streamlit/static/static/js/{index.BasbevcS.js → index.CbzQ6_1A.js} +1 -1
- streamlit/static/static/js/{index.B9_xTTEV.js → index.CfbgQbfG.js} +1 -1
- streamlit/static/static/js/{index.BER0Q_9x.js → index.Co72ELt_.js} +44 -44
- streamlit/static/static/js/{index.CBc6ijSu.js → index.CxXOHy-q.js} +1 -1
- streamlit/static/static/js/index.DCzHBbe3.js +4 -0
- streamlit/static/static/js/{index.iX8U-Vgv.js → index.DDG-Feum.js} +1 -1
- streamlit/static/static/js/{index.B0Ui6vRC.js → index.DDQotaI-.js} +2 -2
- streamlit/static/static/js/{index.BHgKtzWr.js → index.DDTpwEXp.js} +1 -1
- streamlit/static/static/js/{index.eDkLcswt.js → index.DM6381fy.js} +1 -1
- streamlit/static/static/js/{index.BMvd0REJ.js → index.DMsfllEz.js} +1 -1
- streamlit/static/static/js/{index.EtvrDk73.js → index.DVTjGtXy.js} +1 -1
- streamlit/static/static/js/{index.WLh-TFDC.js → index.DY7yFBFm.js} +1 -1
- streamlit/static/static/js/{index.Dvhers7X.js → index.DZLrzThj.js} +1 -1
- streamlit/static/static/js/{index.V-8vv3GC.js → index.DdbxtRVV.js} +1 -1
- streamlit/static/static/js/{index.CI0zYnTG.js → index.DiFAEZZx.js} +1 -1
- streamlit/static/static/js/{index.C_4dOSWN.js → index.Dlgg4mQO.js} +1 -1
- streamlit/static/static/js/index.Dn_JS5iX.js +1 -0
- streamlit/static/static/js/{index.C42wlzzb.js → index.R_5wwEBR.js} +1 -1
- streamlit/static/static/js/{index.C8wS6l2r.js → index.cBacy4AZ.js} +2 -2
- streamlit/static/static/js/{index.DDM9v87n.js → index.d7tjiBmt.js} +1 -1
- streamlit/static/static/js/{input.l_XjOrMQ.js → input.uD0SWj1g.js} +1 -1
- streamlit/static/static/js/{memory.Ctihf9kR.js → memory.DPlzjnEG.js} +1 -1
- streamlit/static/static/js/{mergeWith.C1vYu6FF.js → mergeWith.BtOxrWSG.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.B6AKIEFz.js → number-overlay-editor.B6hW-IjG.js} +1 -1
- streamlit/static/static/js/{sandbox.DhpripZd.js → sandbox.-4pm4kKk.js} +1 -1
- streamlit/static/static/js/{slicedToArray.C54-k4r_.js → slicedToArray.CNy95D8Y.js} +1 -1
- streamlit/static/static/js/{textarea.C2VzK-E-.js → textarea.CcFxFL7j.js} +1 -1
- streamlit/static/static/js/{timepicker.C6vlo4mG.js → timepicker.Char5nqs.js} +1 -1
- streamlit/static/static/js/{uniqueId.C5O-wLYh.js → uniqueId.CNOVHTVB.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.nirky3Hn.js → useBasicWidgetState.Bu8UvcoI.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.DawRSruf.js → useOnInputChange.CF_fWusY.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DMpPC-b8.js → withFullScreenWrapper.bEPeWQAF.js} +1 -1
- streamlit/user_info.py +364 -11
- {streamlit_nightly-1.41.2.dev20250122.dist-info → streamlit_nightly-1.41.2.dev20250123.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.41.2.dev20250122.dist-info → streamlit_nightly-1.41.2.dev20250123.dist-info}/RECORD +71 -71
- streamlit/static/static/js/index.BBP4aKVi.js +0 -1
- streamlit/static/static/js/index.BeOUz4rC.js +0 -4
- {streamlit_nightly-1.41.2.dev20250122.data → streamlit_nightly-1.41.2.dev20250123.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.41.2.dev20250122.dist-info → streamlit_nightly-1.41.2.dev20250123.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.41.2.dev20250122.dist-info → streamlit_nightly-1.41.2.dev20250123.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.41.2.dev20250122.dist-info → streamlit_nightly-1.41.2.dev20250123.dist-info}/top_level.txt +0 -0
@@ -1,4 +0,0 @@
|
|
1
|
-
import{r as c,E as ie,_ as oe,ch as Tt,ci as T,cj as R,ck as Rt,R as st,cl as f,n as m,z as S,j as p,bn as M,bo as Z,b6 as Q,b5 as Lt,cm as Bt,cn as Vt,aY as Ht,F as Nt,az as Wt,bi as $t,aV as Xe,J as _,bk as Kt,bj as Xt,bq as Yt,bD as Gt,br as qt,ba as Jt,bs as Zt}from"./index.BER0Q_9x.js";import{F as Qt}from"./FormClearHelper.DPFVZXH5.js";import{S as er,P as tr}from"./ProgressBar.DGXb6QOO.js";import{u as rr}from"./Hooks.FlVdDTii.js";import{U as q}from"./UploadFileInfo.C-jY39rj.js";var ct=c.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(ie,oe({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});ct.displayName="Clear";var ut=c.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(ie,oe({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});ut.displayName="CloudUpload";var pt=c.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(ie,oe({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});pt.displayName="Error";var dt=c.forwardRef(function(e,r){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(ie,oe({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:r}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"}))});dt.displayName="InsertDriveFile";var P;(function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"})(P||(P={}));const Se=Tt()?1024:1e3,ee=["gb","mb","kb","b"],ae=(e,r,t=1)=>{if(r||(r="b"),t<0&&(t=0),e<0)throw new Error("Size must be greater than or equal to 0");const n=ee.indexOf(r),i=e/Se;return n&&e>Se/2?ae(i,ee[n-1],t):`${e.toFixed(t)}${r.toUpperCase()}`},nr=(e,r,t)=>{if(e<0)throw Error("Size must be 0 or greater");const n=ee.findIndex(s=>s===r),i=ee.findIndex(s=>s===t);if(n===-1||i===-1)throw Error("Unexpected byte unit provided");if(n===i)return e;const o=Math.abs(n-i),l=Se**o;return n>i?e/l:e*l};var ir=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function V(e,r){var t=or(e);if(typeof t.path!="string"){var n=e.webkitRelativePath;Object.defineProperty(t,"path",{value:typeof r=="string"?r:typeof n=="string"&&n.length>0?n:e.name,writable:!1,configurable:!1,enumerable:!0})}return t}function or(e){var r=e.name,t=r&&r.lastIndexOf(".")!==-1;if(t&&!e.type){var n=r.split(".").pop().toLowerCase(),i=ir.get(n);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var ar=[".DS_Store","Thumbs.db"];function lr(e){return T(this,void 0,void 0,function(){return R(this,function(r){return te(e)&&sr(e)?[2,dr(e.dataTransfer,e.type)]:cr(e)?[2,ur(e)]:Array.isArray(e)&&e.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,pr(e)]:[2,[]]})})}function sr(e){return te(e.dataTransfer)}function cr(e){return te(e)&&te(e.target)}function te(e){return typeof e=="object"&&e!==null}function ur(e){return Ee(e.target.files).map(function(r){return V(r)})}function pr(e){return T(this,void 0,void 0,function(){var r;return R(this,function(t){switch(t.label){case 0:return[4,Promise.all(e.map(function(n){return n.getFile()}))];case 1:return r=t.sent(),[2,r.map(function(n){return V(n)})]}})})}function dr(e,r){return T(this,void 0,void 0,function(){var t,n;return R(this,function(i){switch(i.label){case 0:return e===null?[2,[]]:e.items?(t=Ee(e.items).filter(function(o){return o.kind==="file"}),r!=="drop"?[2,t]:[4,Promise.all(t.map(fr))]):[3,2];case 1:return n=i.sent(),[2,Ye(ft(n))];case 2:return[2,Ye(Ee(e.files).map(function(o){return V(o)}))]}})})}function Ye(e){return e.filter(function(r){return ar.indexOf(r.name)===-1})}function Ee(e){if(e===null)return[];for(var r=[],t=0;t<e.length;t++){var n=e[t];r.push(n)}return r}function fr(e){if(typeof e.webkitGetAsEntry!="function")return Ge(e);var r=e.webkitGetAsEntry();return r&&r.isDirectory?gt(r):Ge(e)}function ft(e){return e.reduce(function(r,t){return Rt(r,Array.isArray(t)?ft(t):[t])},[])}function Ge(e){var r=e.getAsFile();if(!r)return Promise.reject(e+" is not a File");var t=V(r);return Promise.resolve(t)}function gr(e){return T(this,void 0,void 0,function(){return R(this,function(r){return[2,e.isDirectory?gt(e):mr(e)]})})}function gt(e){var r=e.createReader();return new Promise(function(t,n){var i=[];function o(){var l=this;r.readEntries(function(s){return T(l,void 0,void 0,function(){var d,w,v;return R(this,function(y){switch(y.label){case 0:if(s.length)return[3,5];y.label=1;case 1:return y.trys.push([1,3,,4]),[4,Promise.all(i)];case 2:return d=y.sent(),t(d),[3,4];case 3:return w=y.sent(),n(w),[3,4];case 4:return[3,6];case 5:v=Promise.all(s.map(gr)),i.push(v),o(),y.label=6;case 6:return[2]}})})},function(s){n(s)})}o()})}function mr(e){return T(this,void 0,void 0,function(){return R(this,function(r){return[2,new Promise(function(t,n){e.file(function(i){var o=V(i,e.fullPath);t(o)},function(i){n(i)})})]})})}var hr=function(e,r){if(e&&r){var t=Array.isArray(r)?r:r.split(","),n=e.name||"",i=(e.type||"").toLowerCase(),o=i.replace(/\/.*$/,"");return t.some(function(l){var s=l.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?o===s.replace(/\/.*$/,""):i===s})}return!0};function qe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function Je(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?qe(Object(t),!0).forEach(function(n){mt(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function mt(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Ze(e,r){return Fr(e)||br(e,r)||yr(e,r)||vr()}function vr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yr(e,r){if(e){if(typeof e=="string")return Qe(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Qe(e,r)}}function Qe(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function br(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],i=!0,o=!1,l,s;try{for(t=t.call(e);!(i=(l=t.next()).done)&&(n.push(l.value),!(r&&n.length===r));i=!0);}catch(d){o=!0,s=d}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}return n}}function Fr(e){if(Array.isArray(e))return e}var wr="file-invalid-type",Dr="file-too-large",xr="file-too-small",Sr="too-many-files",Er=function(r){r=Array.isArray(r)&&r.length===1?r[0]:r;var t=Array.isArray(r)?"one of ".concat(r.join(", ")):r;return{code:wr,message:"File type must be ".concat(t)}},et=function(r){return{code:Dr,message:"File is larger than ".concat(r," ").concat(r===1?"byte":"bytes")}},tt=function(r){return{code:xr,message:"File is smaller than ".concat(r," ").concat(r===1?"byte":"bytes")}},Ar={code:Sr,message:"Too many files"};function ht(e,r){var t=e.type==="application/x-moz-file"||hr(e,r);return[t,t?null:Er(r)]}function vt(e,r,t){if(B(e.size))if(B(r)&&B(t)){if(e.size>t)return[!1,et(t)];if(e.size<r)return[!1,tt(r)]}else{if(B(r)&&e.size<r)return[!1,tt(r)];if(B(t)&&e.size>t)return[!1,et(t)]}return[!0,null]}function B(e){return e!=null}function Or(e){var r=e.files,t=e.accept,n=e.minSize,i=e.maxSize,o=e.multiple,l=e.maxFiles;return!o&&r.length>1||o&&l>=1&&r.length>l?!1:r.every(function(s){var d=ht(s,t),w=Ze(d,1),v=w[0],y=vt(s,n,i),O=Ze(y,1),I=O[0];return v&&I})}function re(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function J(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(r){return r==="Files"||r==="application/x-moz-file"}):!!e.target&&!!e.target.files}function rt(e){e.preventDefault()}function Ir(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Cr(e){return e.indexOf("Edge/")!==-1}function Pr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Ir(e)||Cr(e)}function A(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(n){for(var i=arguments.length,o=new Array(i>1?i-1:0),l=1;l<i;l++)o[l-1]=arguments[l];return r.some(function(s){return!re(n)&&s&&s.apply(void 0,[n].concat(o)),re(n)})}}function zr(){return"showOpenFilePicker"in window}function kr(e){return e=typeof e=="string"?e.split(","):e,[{description:"everything",accept:Array.isArray(e)?e.filter(function(r){return r==="audio/*"||r==="video/*"||r==="image/*"||r==="text/*"||/\w+\/[-+.\w]+/g.test(r)}).reduce(function(r,t){return Je(Je({},r),{},mt({},t,[]))},{}):{}}]}function Ur(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function jr(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}var _r=["children"],Mr=["open"],Tr=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Rr=["refKey","onChange","onClick"];function Lr(e){return Hr(e)||Vr(e)||yt(e)||Br()}function Br(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Hr(e){if(Array.isArray(e))return Ae(e)}function xe(e,r){return $r(e)||Wr(e,r)||yt(e,r)||Nr()}function Nr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yt(e,r){if(e){if(typeof e=="string")return Ae(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ae(e,r)}}function Ae(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Wr(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],i=!0,o=!1,l,s;try{for(t=t.call(e);!(i=(l=t.next()).done)&&(n.push(l.value),!(r&&n.length===r));i=!0);}catch(d){o=!0,s=d}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}return n}}function $r(e){if(Array.isArray(e))return e}function nt(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function g(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?nt(Object(t),!0).forEach(function(n){Oe(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):nt(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Oe(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ne(e,r){if(e==null)return{};var t=Kr(e,r),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function Kr(e,r){if(e==null)return{};var t={},n=Object.keys(e),i,o;for(o=0;o<n.length;o++)i=n[o],!(r.indexOf(i)>=0)&&(t[i]=e[i]);return t}var le=c.forwardRef(function(e,r){var t=e.children,n=ne(e,_r),i=Xr(n),o=i.open,l=ne(i,Mr);return c.useImperativeHandle(r,function(){return{open:o}},[o]),st.createElement(c.Fragment,null,t(g(g({},l),{},{open:o})))});le.displayName="Dropzone";var bt={disabled:!1,getFilesFromEvent:lr,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};le.defaultProps=bt;le.propTypes={children:f.func,accept:f.oneOfType([f.string,f.arrayOf(f.string)]),multiple:f.bool,preventDropOnDocument:f.bool,noClick:f.bool,noKeyboard:f.bool,noDrag:f.bool,noDragEventsBubbling:f.bool,minSize:f.number,maxSize:f.number,maxFiles:f.number,disabled:f.bool,getFilesFromEvent:f.func,onFileDialogCancel:f.func,onFileDialogOpen:f.func,useFsAccessApi:f.bool,onDragEnter:f.func,onDragLeave:f.func,onDragOver:f.func,onDrop:f.func,onDropAccepted:f.func,onDropRejected:f.func,validator:f.func};var Ie={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function Xr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=g(g({},bt),e),t=r.accept,n=r.disabled,i=r.getFilesFromEvent,o=r.maxSize,l=r.minSize,s=r.multiple,d=r.maxFiles,w=r.onDragEnter,v=r.onDragLeave,y=r.onDragOver,O=r.onDrop,I=r.onDropAccepted,se=r.onDropRejected,ce=r.onFileDialogCancel,ue=r.onFileDialogOpen,Pe=r.useFsAccessApi,pe=r.preventDropOnDocument,ze=r.noClick,de=r.noKeyboard,ke=r.noDrag,C=r.noDragEventsBubbling,fe=r.validator,ge=c.useMemo(function(){return typeof ue=="function"?ue:it},[ue]),H=c.useMemo(function(){return typeof ce=="function"?ce:it},[ce]),D=c.useRef(null),x=c.useRef(null),Pt=c.useReducer(Yr,Ie),Ue=xe(Pt,2),N=Ue[0],F=Ue[1],zt=N.isFocused,je=N.isFileDialogActive,_e=N.draggedFiles,W=c.useRef(typeof window<"u"&&window.isSecureContext&&Pe&&zr()),Me=function(){!W.current&&je&&setTimeout(function(){if(x.current){var u=x.current.files;u.length||(F({type:"closeDialog"}),H())}},300)};c.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[x,je,H,W]);var z=c.useRef([]),Te=function(u){D.current&&D.current.contains(u.target)||(u.preventDefault(),z.current=[])};c.useEffect(function(){return pe&&(document.addEventListener("dragover",rt,!1),document.addEventListener("drop",Te,!1)),function(){pe&&(document.removeEventListener("dragover",rt),document.removeEventListener("drop",Te))}},[D,pe]);var Re=c.useCallback(function(a){a.preventDefault(),a.persist(),Y(a),z.current=[].concat(Lr(z.current),[a.target]),J(a)&&Promise.resolve(i(a)).then(function(u){re(a)&&!C||(F({draggedFiles:u,isDragActive:!0,type:"setDraggedFiles"}),w&&w(a))})},[i,w,C]),Le=c.useCallback(function(a){a.preventDefault(),a.persist(),Y(a);var u=J(a);if(u&&a.dataTransfer)try{a.dataTransfer.dropEffect="copy"}catch{}return u&&y&&y(a),!1},[y,C]),Be=c.useCallback(function(a){a.preventDefault(),a.persist(),Y(a);var u=z.current.filter(function(b){return D.current&&D.current.contains(b)}),h=u.indexOf(a.target);h!==-1&&u.splice(h,1),z.current=u,!(u.length>0)&&(F({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),J(a)&&v&&v(a))},[D,v,C]),$=c.useCallback(function(a,u){var h=[],b=[];a.forEach(function(E){var L=ht(E,t),j=xe(L,2),he=j[0],ve=j[1],ye=vt(E,l,o),G=xe(ye,2),be=G[0],Fe=G[1],we=fe?fe(E):null;if(he&&be&&!we)h.push(E);else{var De=[ve,Fe];we&&(De=De.concat(we)),b.push({file:E,errors:De.filter(function(Mt){return Mt})})}}),(!s&&h.length>1||s&&d>=1&&h.length>d)&&(h.forEach(function(E){b.push({file:E,errors:[Ar]})}),h.splice(0)),F({acceptedFiles:h,fileRejections:b,type:"setFiles"}),O&&O(h,b,u),b.length>0&&se&&se(b,u),h.length>0&&I&&I(h,u)},[F,s,t,l,o,d,O,I,se,fe]),K=c.useCallback(function(a){a.preventDefault(),a.persist(),Y(a),z.current=[],J(a)&&Promise.resolve(i(a)).then(function(u){re(a)&&!C||$(u,a)}),F({type:"reset"})},[i,$,C]),k=c.useCallback(function(){if(W.current){F({type:"openDialog"}),ge();var a={multiple:s,types:kr(t)};window.showOpenFilePicker(a).then(function(u){return i(u)}).then(function(u){$(u,null),F({type:"closeDialog"})}).catch(function(u){Ur(u)?(H(u),F({type:"closeDialog"})):jr(u)&&(W.current=!1,x.current&&(x.current.value=null,x.current.click()))});return}x.current&&(F({type:"openDialog"}),ge(),x.current.value=null,x.current.click())},[F,ge,H,Pe,$,t,s]),Ve=c.useCallback(function(a){!D.current||!D.current.isEqualNode(a.target)||(a.key===" "||a.key==="Enter"||a.keyCode===32||a.keyCode===13)&&(a.preventDefault(),k())},[D,k]),He=c.useCallback(function(){F({type:"focus"})},[]),Ne=c.useCallback(function(){F({type:"blur"})},[]),We=c.useCallback(function(){ze||(Pr()?setTimeout(k,0):k())},[ze,k]),U=function(u){return n?null:u},me=function(u){return de?null:U(u)},X=function(u){return ke?null:U(u)},Y=function(u){C&&u.stopPropagation()},kt=c.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.refKey,h=u===void 0?"ref":u,b=a.role,E=a.onKeyDown,L=a.onFocus,j=a.onBlur,he=a.onClick,ve=a.onDragEnter,ye=a.onDragOver,G=a.onDragLeave,be=a.onDrop,Fe=ne(a,Tr);return g(g(Oe({onKeyDown:me(A(E,Ve)),onFocus:me(A(L,He)),onBlur:me(A(j,Ne)),onClick:U(A(he,We)),onDragEnter:X(A(ve,Re)),onDragOver:X(A(ye,Le)),onDragLeave:X(A(G,Be)),onDrop:X(A(be,K)),role:typeof b=="string"&&b!==""?b:"button"},h,D),!n&&!de?{tabIndex:0}:{}),Fe)}},[D,Ve,He,Ne,We,Re,Le,Be,K,de,ke,n]),Ut=c.useCallback(function(a){a.stopPropagation()},[]),jt=c.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.refKey,h=u===void 0?"ref":u,b=a.onChange,E=a.onClick,L=ne(a,Rr),j=Oe({accept:t,multiple:s,type:"file",style:{display:"none"},onChange:U(A(b,K)),onClick:U(A(E,Ut)),tabIndex:-1},h,x);return g(g({},j),L)}},[x,t,s,K,n]),$e=_e.length,Ke=$e>0&&Or({files:_e,accept:t,minSize:l,maxSize:o,multiple:s,maxFiles:d}),_t=$e>0&&!Ke;return g(g({},N),{},{isDragAccept:Ke,isDragReject:_t,isFocused:zt&&!n,getRootProps:kt,getInputProps:jt,rootRef:D,inputRef:x,open:U(k)})}function Yr(e,r){switch(r.type){case"focus":return g(g({},e),{},{isFocused:!0});case"blur":return g(g({},e),{},{isFocused:!1});case"openDialog":return g(g({},Ie),{},{isFileDialogActive:!0});case"closeDialog":return g(g({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=r.isDragActive,n=r.draggedFiles;return g(g({},e),{},{draggedFiles:n,isDragActive:t});case"setFiles":return g(g({},e),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections});case"reset":return g({},Ie);default:return e}}function it(){}const Ft=m("section",{target:"e1orukol0"})(({isDisabled:e,theme:r})=>({display:"flex",alignItems:"center",padding:r.spacing.lg,backgroundColor:r.colors.secondaryBg,borderRadius:r.radii.default,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${r.colors.primary}`},color:e?r.colors.gray:r.colors.bodyText})),wt=m("div",{target:"e1orukol1"})({marginRight:"auto",alignItems:"center",display:"flex"}),Dt=m("span",{target:"e1orukol2"})(({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),Gr=m("span",{target:"e1orukol3"})(({theme:e})=>({marginBottom:e.spacing.twoXS})),qr=m("div",{target:"e1orukol4"})({display:"flex",flexDirection:"column"}),xt=m("div",{target:"e1orukol5"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),Jr=m("ul",{target:"e1orukol6"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),St=m("li",{target:"e1orukol7"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),Et=m("div",{target:"e1orukol8"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),At=m("div",{target:"e1orukol9"})(({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),Ot=m("div",{target:"e1orukol10"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),Zr=m("span",{target:"e1orukol11"})(({theme:e})=>({marginRight:e.spacing.twoXS})),Qr=m("div",{target:"e1orukol12"})(({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),It=m("small",{target:"e1orukol13"})(({theme:e})=>({color:e.colors.danger,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),Ct=m("span",{target:"e1orukol14"})({}),ot=e=>({[Ft]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[wt]:{marginBottom:e.spacing.lg},[Dt]:{display:"none"},[xt]:{paddingRight:e.spacing.lg},[Ot]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[At]:{width:e.sizes.full},[Et]:{flexDirection:"column"},[It]:{height:"auto",whiteSpace:"initial"},[Ct]:{display:"none"},[St]:{margin:e.spacing.none,padding:e.spacing.none}}),en=m("div",{target:"e1orukol15"})(({theme:e})=>e.inSidebar?ot(e):{[`@media (max-width: ${e.breakpoints.sm})`]:ot(e)});var at;(function(e){e.DANGER="danger"})(at||(at={}));const Ce=m("small",{target:"ejh2rmr0"})(({kind:e,theme:r})=>{const{danger:t,fadedText60:n}=r.colors;return{color:e==="danger"?t:n,fontSize:r.fontSizes.sm,lineHeight:r.lineHeights.tight}}),tn=({multiple:e,acceptedExtensions:r,maxSizeBytes:t})=>S(wt,{"data-testid":"stFileUploaderDropzoneInstructions",children:[p(Dt,{children:p(M,{content:ut,size:"threeXL"})}),S(qr,{children:[S(Gr,{children:["Drag and drop file",e?"s":""," here"]}),S(Ce,{children:[`Limit ${ae(t,P.Byte,0)} per file`,r.length?` • ${r.map(n=>n.replace(/^\./,"").toUpperCase()).join(", ")}`:null]})]})]}),rn=({onDrop:e,multiple:r,acceptedExtensions:t,maxSizeBytes:n,disabled:i,label:o})=>p(le,{onDrop:e,multiple:r,accept:t.length?t:void 0,maxSize:n,disabled:i,useFsAccessApi:!1,children:({getRootProps:l,getInputProps:s})=>S(Ft,{...l(),"data-testid":"stFileUploaderDropzone",isDisabled:i,"aria-label":o,children:[p("input",{"data-testid":"stFileUploaderDropzoneInput",...s()}),p(tn,{multiple:r,acceptedExtensions:t,maxSizeBytes:n}),p(Z,{kind:Q.SECONDARY,disabled:i,size:Lt.SMALL,children:"Browse files"})]})}),nn=m("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),on=m("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),an=({currentPage:e,totalPages:r,onNext:t,onPrevious:n})=>S(nn,{"data-testid":"stFileUploaderPagination",children:[p(Ce,{children:`Showing page ${e} of ${r}`}),S(on,{children:[p(Z,{onClick:n,kind:Q.MINIMAL,children:p(M,{content:Bt,size:"xl"})}),p(Z,{onClick:t,kind:Q.MINIMAL,children:p(M,{content:Vt,size:"xl"})})]})]}),lt=(e,r)=>Math.ceil(e.length/r),ln=e=>Ht(({pageSize:t,items:n,resetOnAdd:i,...o})=>{const[l,s]=c.useState(0),[d,w]=c.useState(lt(n,t)),v=rr(n);c.useEffect(()=>{v&&v.length!==n.length&&w(lt(n,t)),v&&v.length<n.length?i&&s(0):l+1>=d&&s(d-1)},[n,l,t,v,i,d]);const y=()=>{s(Math.min(l+1,d-1))},O=()=>{s(Math.max(0,l-1))},I=n.slice(l*t,l*t+t);return S(Nt,{children:[p(e,{items:I,...o}),n.length>t?p(an,{pageSize:t,totalPages:d,currentPage:l+1,onNext:y,onPrevious:O}):null]})},e),sn=({fileInfo:e})=>e.status.type==="uploading"?p(tr,{value:e.status.progress,size:er.SMALL}):e.status.type==="error"?S(It,{children:[p(Zr,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),p(Ct,{children:p(M,{content:pt,size:"lg"})})]}):e.status.type==="uploaded"?p(Ce,{children:ae(e.size,P.Byte)}):null,cn=({fileInfo:e,onDelete:r})=>S(Ot,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[p(Qr,{children:p(M,{content:dt,size:"twoXL"})}),S(Et,{className:"stFileUploaderFileData",children:[p(At,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,children:e.name}),p(sn,{fileInfo:e})]}),p("div",{"data-testid":"stFileUploaderDeleteBtn",children:p(Z,{onClick:()=>r(e.id),kind:Q.MINIMAL,children:p(M,{content:ct,size:"lg"})})})]}),un=({items:e,onDelete:r})=>p(Jr,{children:e.map(t=>p(St,{children:p(cn,{fileInfo:t,onDelete:r})},t.id))}),pn=ln(un),dn=e=>p(xt,{children:p(pn,{...e})});class yn extends st.PureComponent{constructor(r){super(r),this.formClearHelper=new Qt,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:n,widgetMgr:i,fragmentId:o}=this.props,l=i.getFileUploaderStateValue(n);Wt(t,l)||i.setFileUploaderStateValue(n,t,{fromUi:!0},o)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(t,n)=>{const{element:i}=this.props,{multipleFiles:o}=i;if(!o&&t.length===0&&n.length>1){const l=n.findIndex(s=>s.errors.length===1&&s.errors[0].code==="too-many-files");l>=0&&(t.push(n[l].file),n.splice(l,1))}if(this.props.uploadClient.fetchFileURLs(t).then(l=>{if(!o&&t.length>0){const s=this.state.files.find(d=>d.status.type!=="error");s&&(this.forceUpdatingStatus=!0,this.deleteFile(s.id),this.forceUpdatingStatus=!1)}$t(l,t).forEach(([s,d])=>{this.uploadFile(s,d)})}).catch(l=>{this.addFiles(t.map(s=>new q(s.name,s.size,this.nextLocalFileId(),{type:"error",errorMessage:l})))}),n.length>0){const l=n.map(s=>{const{file:d}=s;return new q(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(s.errors[0].code,s.file)})});this.addFiles(l)}},this.uploadFile=(t,n)=>{const i=Xe.CancelToken.source(),o=new q(n.name,n.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(o),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,n,l=>this.onUploadProgress(l,o.id),i.token).then(()=>this.onUploadComplete(o.id,t)).catch(l=>{Xe.isCancel(l)||this.updateFile(o.id,o.setStatus({type:"error",errorMessage:l?l.toString():"Unknown error"}))})},this.onUploadComplete=(t,n)=>{const i=this.getFile(t);_(i)||i.status.type!=="uploading"||this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}))},this.getErrorMessage=(t,n)=>{switch(t){case"file-too-large":return`File must be ${ae(this.maxUploadSizeInBytes,P.Byte)} or smaller.`;case"file-invalid-type":return`${n.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."}},this.deleteFile=t=>{const n=this.getFile(t);_(n)||(n.status.type==="uploading"&&n.status.cancelToken.cancel(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(n.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(n=>({files:[...n.files,t]}))},this.addFiles=t=>{this.setState(n=>({files:[...n.files,...t]}))},this.removeFile=t=>{this.setState(n=>({files:n.files.filter(i=>i.id!==t)}))},this.getFile=t=>this.state.files.find(n=>n.id===t),this.updateFile=(t,n)=>{this.setState(i=>({files:i.files.map(o=>o.id===t?n:o)}))},this.onUploadProgress=(t,n)=>{const i=this.getFile(n);if(_(i)||i.status.type!=="uploading")return;const o=Math.round(t.loaded*100/t.total);i.status.progress!==o&&this.updateFile(n,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:o}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(_(t))return;const{widgetMgr:n,element:i,fragmentId:o}=this.props;n.setFileUploaderStateValue(i,t,{fromUi:!0},o)})},this.state=this.initialValue}get initialValue(){const r={files:[],newestServerFileId:0},{widgetMgr:t,element:n}=this.props,i=t.getFileUploaderStateValue(n);if(_(i))return r;const{uploadedFileInfo:o}=i;return _(o)||o.length===0?r:{files:o.map(l=>{const s=l.name,d=l.size,w=l.fileId,v=l.fileUrls;return new q(s,d,this.nextLocalFileId(),{type:"uploaded",fileId:w,fileUrls:v})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const r=this.props.element.maxUploadSizeMb;return nr(r,P.Megabyte,P.Byte)}get status(){const r=t=>t.status.type==="uploading";return this.state.files.some(r)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const r=this.createWidgetValue(),{element:t,widgetMgr:n,fragmentId:i}=this.props;n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,r,{fromUi:!1},i)}createWidgetValue(){const r=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:n,size:i,status:o}=t,{fileId:l,fileUrls:s}=o;return new Kt({fileId:l,fileUrls:s,name:n,size:i})});return new Xt({uploadedFileInfo:r})}render(){var s;const{files:r}=this.state,{element:t,disabled:n,widgetMgr:i}=this.props,o=t.type;this.formClearHelper.manageFormClearListener(i,t.formId,this.onFormCleared);const l=r.slice().reverse();return S(en,{className:"stFileUploader","data-testid":"stFileUploader",children:[p(Zt,{label:t.label,disabled:n,labelVisibility:Yt((s=t.labelVisibility)==null?void 0:s.value),children:t.help&&p(Gt,{children:p(qt,{content:t.help,placement:Jt.TOP_RIGHT})})}),p(rn,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:o,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:n}),l.length>0&&p(dn,{items:l,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}export{yn as default};
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|