Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.84/admin/js/components/share-form/Email.es",["module","exports","require","@frontend-taglib-clay$clayui/data-provider","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/multi-select","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=a("@frontend-taglib-clay$clayui/data-provider"),r=c(a("@frontend-taglib-clay$clayui/form")),n=c(a("@frontend-taglib-clay$clayui/multi-select")),u=c(a("liferay!frontend-js-react-web$react"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function c(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 s(e){return"".concat(e.fullName," (").concat(e.emailAddress,")")}function d(e){return/.+@.+\..+/i.test(e.label)}function f(e,t){return e.length?(0,n.itemLabelFilter)(e.map((e=>({label:e.emailAddress,value:s(e)}))),t):e}var i=({addresses:e,autocompleteUserURL:t,emailContent:a,message:o,onMessageChanged:c,onMultiSelectItemsChanged:s,onSubjectChanged:i,subject:m})=>{const[g,p]=(0,u.useState)(""),[y,b]=(0,u.useState)(4),{resource:h}=(0,l.useResource)({fetchPolicy:"cache-first",link:t,onNetworkStatusChange:b});return u.default.createElement("div",{className:"share-form-modal-item-email"},u.default.createElement(r.default.Group,null,u.default.createElement("label",null,Liferay.Language.get("to")),u.default.createElement(r.ClayInput.Group,{small:!0,stacked:!0},u.default.createElement(r.ClayInput.GroupItem,null,!(5===y)&&u.default.createElement(u.default.Fragment,null,u.default.createElement(n.default,{closeButtonAriaLabel:Liferay.Language.get("remove"),inputValue:g,items:e,onChange:p,onClearAllButtonClick:()=>{a.current.addresses=[],s([])},onItemsChange:e=>{if(!e.length)return a.current.addresses=e,s(e);const t=e.filter(d);return t.length?(a.current.addresses=t,s(t)):void 0},placeholder:Liferay.Language.get("enter-a-list-of-email-addresses"),sourceItems:h?f(h,g):[]}),u.default.createElement(r.default.FeedbackGroup,null,u.default.createElement(r.default.Text,null,Liferay.Language.get("type-a-comma-or-press-enter-to-input-email-addresses"))))))),u.default.createElement(r.default.Group,null,u.default.createElement("label",{htmlFor:"subject"},Liferay.Language.get("subject")),u.default.createElement(r.ClayInput.Group,null,u.default.createElement(r.ClayInput.GroupItem,null,u.default.createElement(r.ClayInput,{className:"form-control",id:"subject",onChange:({target:{value:e}})=>{a.current.subject=e,i(e)},type:"text",value:m})))),u.default.createElement(r.default.Group,null,u.default.createElement("label",{htmlFor:"message"},Liferay.Language.get("message")),u.default.createElement(r.ClayInput.Group,null,u.default.createElement(r.ClayInput.GroupItem,null,u.default.createElement(r.ClayInput,{className:"form-control",component:"textarea",id:"message",onChange:({target:{value:e}})=>{a.current.message=e,c(e)},type:"text",value:o})))))};t.default=i}}));
//# sourceMappingURL=Email.es.js.map