Liferay.Loader.define("depot-web@2.0.68/js/Languages.es",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./LanguagesList.es","./ManageLanguages.es","../css/Languages.scss"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=_interopRequireDefault(t("@frontend-taglib-clay$clayui/alert")),n=t("@frontend-taglib-clay$clayui/form"),r=t("@frontend-taglib-clay$clayui/modal"),i=(_interopRequireDefault(t("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache();if(a&&a.has(e))return a.get(e);var t={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(t,n,r):t[n]=e[n]}t.default=e,a&&a.set(e,t);return t}(t("liferay!frontend-js-react-web$react"))),o=_interopRequireDefault(t("./LanguagesList.es")),u=_interopRequireDefault(t("./ManageLanguages.es"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t("../css/Languages.scss");const getLocalesInputValue=e=>e.map((({localeId:e})=>e)).join(",");var _default=({availableLocales:e,defaultLocaleId:a,inheritLocales:t=!0,portletNamespace:c,siteAvailableLocales:s,siteDefaultLocaleId:d,translatedLanguages:f})=>{const[g,p]=(0,i.useState)(t),[y,L]=(0,i.useState)(d),[m,b]=(0,i.useState)(s),[v,w]=(0,i.useState)(getLocalesInputValue(s)),[h,_]=(0,i.useState)(!1),[E,C]=(0,i.useState)(!1),[j,R]=(0,i.useState)(!1),{observer:D,onClose:q}=(0,r.useModal)({onClose:()=>{R(!1)}}),moveItem=(e,a)=>{b((t=>function move(e,a,t){const l=[...e],n=l.splice(a,1)[0];return l.splice(t,0,n),l}(t,e,a)))};return(0,i.useEffect)((()=>{g||w(getLocalesInputValue(m))}),[m,g]),i.default.createElement("div",{className:"mt-5"},i.default.createElement(n.ClayRadioGroup,{name:"".concat(c,"TypeSettingsProperties--inheritLocales--"),onChange:p,value:g},i.default.createElement(n.ClayRadio,{label:Liferay.Language.get("use-the-default-language-options"),value:!0}),i.default.createElement(n.ClayRadio,{label:Liferay.Language.get("define-a-custom-default-language-and-additional-active-languages-for-this-asset-library"),value:!1})),g?i.default.createElement(o.default,{defaultLocaleId:a,locales:e}):i.default.createElement(i.default.Fragment,null,i.default.createElement("input",{name:"".concat(c,"TypeSettingsProperties--languageId--"),type:"hidden",value:y}),i.default.createElement("input",{name:"".concat(c,"TypeSettingsProperties--locales--"),type:"hidden",value:v}),i.default.createElement(o.default,{defaultLocaleId:y,isEditable:!0,locales:m,moveItem:moveItem,onEditBtnClick:()=>{R(!0)},onItemDrop:(e,a)=>{moveItem(e,a)},onMakeDefault:({localeId:e})=>{L(e),_(!0),C(f&&!f[e])}})),j&&i.default.createElement(u.default,{availableLocales:e,customDefaultLocaleId:y,customLocales:m,observer:D,onModalClose:q,onModalDone:e=>{b(e),q()}}),h&&i.default.createElement(l.default,{displayType:"warning",onClose:()=>_(!1),title:Liferay.Language.get("warning")},Liferay.Language.get("this-change-will-only-affect-the-newly-created-localized-content")),E&&i.default.createElement(l.default,{displayType:"warning",onClose:()=>C(!1),title:Liferay.Language.get("warning")},Liferay.Language.get("asset-library-name-will-display-a-generic-text-until-a-translation-is-added")))};a.default=_default}}));
//# sourceMappingURL=Languages.es.js.map