Liferay.Loader.define("data-engine-taglib@3.3.53/data_layout_builder/js/components/translation-manager/TranslationManager.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.formatLabel=formatLabel,a.formatIcon=formatIcon,a.TranslationManagerLabel=TranslationManagerLabel,a.default=function TranslationManager({availableLanguageIds:e,defaultLanguageId:a=themeDisplay.getDefaultLanguageId(),editingLanguageId:t=themeDisplay.getDefaultLanguageId(),onActiveChange:i=(()=>{}),onEditingLanguageIdChange:c,showUserView:f=!1,translatedLanguageIds:d,className:s}){const[g,m]=(0,u.useState)(!1),[b,p]=(0,u.useState)({}),[y,L]=(0,u.useState)({});return(0,u.useEffect)((()=>{L(Liferay.Language.available)}),[]),(0,u.useEffect)((()=>{p(e||y)}),[y,e]),(0,u.useEffect)((()=>{i(g)}),[g,i]),u.default.createElement(n.default,{active:g,className:(0,o.default)("localizable-dropdown",s),onActiveChange:e=>m(e),trigger:u.default.createElement(l.default,{displayType:"secondary",monospaced:!f,small:f,symbol:formatLabel(t)},u.default.createElement("span",{className:"inline-item"},u.default.createElement(r.default,{symbol:formatIcon(t)})),f?u.default.createElement("span",{className:"localizable-dropdown-label ml-2"},y[t]):u.default.createElement("span",{className:"btn-section"},formatLabel(t)),f&&u.default.createElement(r.default,{className:"ml-2",symbol:"caret-bottom"}))},u.default.createElement(n.default.ItemList,{className:"localizable-dropdown-ul"},Object.keys(b).map(((e,t)=>u.default.createElement(n.default.Item,{className:(0,o.default)("autofit-row",{"localizable-item-default":e===a}),key:t,onClick:()=>{c(e),m(!1)}},u.default.createElement("span",{className:"autofit-col autofit-col-expand"},u.default.createElement("span",{className:"autofit-section"},u.default.createElement("span",{className:"inline-item inline-item-before"},u.default.createElement(r.default,{symbol:formatIcon(e)})),f?y[e]:formatLabel(e))),!f&&u.default.createElement(TranslationManagerLabel,{defaultLanguageId:a,languageId:e,translatedLanguageIds:d}))))))};var l=_interopRequireDefault(t("@frontend-taglib-clay$clayui/button")),n=_interopRequireDefault(t("@frontend-taglib-clay$clayui/drop-down")),r=_interopRequireDefault(t("@frontend-taglib-clay$clayui/icon")),o=_interopRequireDefault(t("liferay!frontend-js-react-web$classnames")),u=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"));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}}function formatLabel(e){return e.replace("_","-")}function formatIcon(e){return formatLabel(e).toLowerCase()}function TranslationManagerLabel({defaultLanguageId:e,languageId:a,translatedLanguageIds:t}){let l="label-warning",n=Liferay.Language.get("not-translated");return a===e?(l="label-info",n=Liferay.Language.get("default")):t[a]&&(l="label-success",n=Liferay.Language.get("translated")),u.default.createElement("span",{className:"autofit-col"},u.default.createElement("span",{className:(0,o.default)("label",l)},u.default.createElement("span",{className:"label-item label-item-expand"},n)))}}}));
//# sourceMappingURL=TranslationManager.es.js.map