Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/ObjectRelationship/SelectRelationship",["module","exports","require","@liferay/object-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{error:t,objectDefinitionId:r,onChange:a,value:l}=e,f=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["error","objectDefinitionId","onChange","value"]);const[u,c]=(0,o.useState)([]),s=(0,o.useMemo)((()=>u.map((({label:e})=>e[Liferay.ThemeDisplay.getDefaultLanguageId()]))),[u]),p=(0,o.useMemo)((()=>{const e=u.findIndex((({id:e})=>e===l));return-1===e?void 0:e}),[u,l]);return(0,o.useEffect)((()=>{r?n.API.getObjectFields(r).then((e=>{const t=e.filter((({businessType:e})=>"Relationship"===e));c(t)})):c([])}),[r]),o.default.createElement(n.Select,i({error:t,label:Liferay.Language.get("parameter"),onChange:e=>{null==a||a(u[Number(e.target.value)].id)},options:s,required:!0,tooltip:Liferay.Language.get("choose-a-relationship-field-from-the-selected-object"),value:p},f))};var n=r("@liferay/object-js-components-web"),o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}}}));
//# sourceMappingURL=SelectRelationship.js.map