Liferay.Loader.define("@liferay/document-library-web@6.0.111/document_library/js/file-size-limit/FileSizeMimetypes",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","liferay!document-library-web$uuid/v4","../../css/file_size_mimetypes.scss"],(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=f(a("@frontend-taglib-clay$clayui/form")),n=d(a("@frontend-taglib-clay$clayui/icon")),i=d(a("@frontend-taglib-clay$clayui/layout")),u=(d(a("liferay!frontend-js-react-web$prop-types")),f(a("liferay!frontend-js-react-web$react"))),c=d(a("liferay!document-library-web$uuid/v4"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();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}function d(e){return e&&e.__esModule?e:{default:e}}function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,l)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){y(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function y(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}a("../../css/file_size_mimetypes.scss");const e="".concat(Liferay.Language.get("error-colon")," ").concat(Liferay.Language.get("please-enter-a-valid-number")),b=({handleAddClick:t,handleRemoveClick:a,index:c,mimeType:o="",portletNamespace:f,size:d=""})=>{const[m,s]=(0,u.useState)("");return u.default.createElement(i.default.Row,{className:"size-limit-row"},u.default.createElement(i.default.Col,{md:"6"},u.default.createElement("label",{htmlFor:"mimeType"},Liferay.Language.get("mime-type-field-label"),u.default.createElement("span",{className:"inline-item-after",title:Liferay.Language.get("mime-type-help-message")},u.default.createElement(n.default,{symbol:"question-circle-full"}))),u.default.createElement(r.ClayInput,{defaultValue:o,id:"mimeType",name:"".concat(f,"mimeType_").concat(c),type:"text"})),u.default.createElement(i.default.Col,{className:m?"has-error":"",md:"6"},u.default.createElement("label",{htmlFor:"size"},Liferay.Language.get("maximum-file-size"),u.default.createElement("span",{className:"inline-item-after",title:Liferay.Language.get("maximum-file-size-help-message")},u.default.createElement(n.default,{symbol:"question-circle-full"}))),u.default.createElement(r.ClayInput,{defaultValue:d,id:"size",name:"".concat(f,"size_").concat(c),onChange:({target:t})=>{s(t.validity.valid&&Number(t.value)>=0?"":e)},type:"number"}),c>0&&u.default.createElement(l.default,{"aria-label":Liferay.Language.get("remove"),className:"dm-field-repeatable-delete-button",onClick:()=>a(c),small:!0,title:Liferay.Language.get("remove"),type:"button"},u.default.createElement(n.default,{symbol:"hr"})),u.default.createElement(l.default,{className:"dm-field-repeatable-add-button",onClick:()=>t(c),small:!0,title:Liferay.Language.get("add"),type:"button"},u.default.createElement(n.default,{symbol:"plus"})),m&&u.default.createElement(r.default.FeedbackGroup,null,u.default.createElement(r.default.FeedbackItem,null,u.default.createElement(r.default.FeedbackIndicator,{symbol:"exclamation-full"}),m))))};var p=({description:e=Liferay.Language.get("file-size-mime-type-description"),portletNamespace:t,sizeList:a})=>{const l=()=>({id:(0,c.default)(),mimeType:"",size:""}),r=e=>{const t=[...i];t.splice(e+1,0,l()),o(t)},n=e=>{const t=[...i];t.splice(e,1),o(t)},[i,o]=(0,u.useState)(a&&a.length?a.map((e=>s(s({},e),{},{id:(0,c.default)()}))):[l()]);return u.default.createElement(u.default.Fragment,null,u.default.createElement("p",{className:"text-muted"},Liferay.Language.get(e)),i.map(((e,a)=>u.default.createElement(b,{handleAddClick:r,handleRemoveClick:n,index:a,key:e.id,mimeType:e.mimeType,portletNamespace:t,size:e.size}))))};t.default=p}}));
//# sourceMappingURL=FileSizeMimetypes.js.map