Liferay.Loader.define("@liferay/document-library-web@6.0.112/document_library/js/FileEntryPicker",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=d(a("@frontend-taglib-clay$clayui/button")),r=d(a("@frontend-taglib-clay$clayui/form")),n=o(a("@frontend-taglib-clay$clayui/icon")),i=o(a("liferay!frontend-js-react-web$classnames")),u=a("frontend-js-web"),f=(o(a("liferay!frontend-js-react-web$prop-types")),d(a("liferay!frontend-js-react-web$react")));function o(e){return e&&e.__esModule?e:{default:e}}function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}var s=({maxFileSize:e,maxMimeTypeSize:t,namespace:a,validExtensions:o})=>{const[c,d]=(0,f.useState)(Number(e)),s="".concat(a,"file"),[y,m]=(0,f.useState)(""),[p,b]=(0,f.useState)(""),[g,v]=(0,f.useState)(!1),w=(0,f.useRef)();return(0,f.useEffect)((()=>{b(y?y.replace(/^.*[\\]/,""):"")}),[y]),f.default.createElement(r.default.Group,{className:(0,i.default)({"has-error":g})},f.default.createElement(l.default,{displayType:"secondary",onClick:()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.click()},title:Liferay.Language.get("select-file")},Liferay.Language.get("select-file")),p&&f.default.createElement(f.default.Fragment,null,f.default.createElement("small",{className:"inline-item inline-item-after"},f.default.createElement("strong",null,p)),f.default.createElement(l.ClayButtonWithIcon,{borderless:!0,displayType:"secondary",monospaced:!0,onClick:()=>m(""),symbol:"times-circle-full"})),f.default.createElement(r.ClayInput,{accept:o,className:"d-none",id:s,name:s,onChange:({target:l})=>{var r,n;const i=null===(r=l.files[0])||void 0===r?void 0:r.type,u=Number(t[i]);let f=Number(e);u&&f>u&&(f=u),d(f),(null===(n=l.files[0])||void 0===n?void 0:n.size)>f?(v(!0),m("")):(v(!1),m(l.value),window["".concat(a,"updateFileNameAndTitle")]())},ref:w,type:"file",value:y}),g&&f.default.createElement(r.default.FeedbackGroup,null,f.default.createElement(r.default.FeedbackItem,null,f.default.createElement(n.default,{className:"mr-1",symbol:"exclamation-full"}),(0,u.sub)(Liferay.Language.get("please-enter-a-file-with-a-valid-file-size-no-larger-than-x"),(0,u.formatStorage)(c,{addSpaceBeforeSuffix:!0})))))};t.default=s}}));
//# sourceMappingURL=FileEntryPicker.js.map