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