'use strict';
'use client';
import { sortOrders } from '../../../../fd-toolbox/enums/enums.js';
import { isNullOrUndefined } from '../../../../fd-toolbox/functions/value-checking-functions.js';
import { getObjectValues } from '../../../../fd-toolbox/lib/utils.js';
import { navigateToList } from '../../resource-list/resource-lists.js';
import { setFlagEnumValues, isIdProperty } from '../../services/property-fields.js';

var __defProp=Object['defineProperty'],__name=(_0x5039f9,_0x508d4b)=>__defProp(_0x5039f9,'name',{'value':_0x508d4b,'configurable':!![]});function updateExcludeResourceIds(_0x4c36d8,_0x54dcde,_0x28364b){return _0x54dcde['manyToManyInfo']?.['isMirrorManyToManyResource']&&(_0x28364b['set'](_0x54dcde['manyToManyInfo']['manyToManyFirstPropertyName'],[_0x4c36d8[_0x54dcde['manyToManyInfo']['manyToManySecondPropertyName']]]),_0x28364b['set'](_0x54dcde['manyToManyInfo']['manyToManySecondPropertyName'],[_0x4c36d8[_0x54dcde['manyToManyInfo']['manyToManyFirstPropertyName']]])),_0x28364b;}__name(updateExcludeResourceIds,'updateExcludeResourceIds');function shouldBeVisible(_0x5fef73,_0x51bf7a,_0x15ec6a){if(_0x15ec6a)return !![];let _0xfe6873=_0x51bf7a['propertyConfigs']['get'](_0x5fef73['name']);if(_0x51bf7a['whitelistPropertiesOnly']&&!_0xfe6873)return ![];if(!isNullOrUndefined(_0xfe6873?.['visible']))return _0xfe6873['visible'];else {if(_0x51bf7a['whitelistPropertiesOnly'])return ![];}return !![];}__name(shouldBeVisible,'shouldBeVisible');function getPropertyCssClass(_0xc9dc06,_0x461ece,_0x5ca109){let _0x1456b2='inline-block\x20w-full',_0x2cc706=_0x1456b2+'\x20hidden';return shouldBeVisible(_0xc9dc06,_0x461ece,_0x5ca109)?_0x1456b2:_0x1456b2+'\x20'+_0x2cc706;}__name(getPropertyCssClass,'getPropertyCssClass');function getUiPropertyMetas(_0x5af5c4){return getObjectValues(_0x5af5c4);}__name(getUiPropertyMetas,'getUiPropertyMetas');function getPropertyMetas(_0x23fcab){return getObjectValues(_0x23fcab);}__name(getPropertyMetas,'getPropertyMetas');function onPropsChange(_0x46f13e,_0x21616e,_0x4edc10,_0x3fc296,_0x4e0957){return _0x4e0957&&(setFlagEnumValues(_0x4e0957['properties'],_0x46f13e['getValues'],_0x46f13e['setValue']),_0x21616e(_0x39cd7f=>updateExcludeResourceIds(_0x4edc10,_0x4e0957,_0x39cd7f))),_0x3fc296['value']++,()=>{_0x3fc296['value']--;};}__name(onPropsChange,'onPropsChange');function getSortedUiPropertyMetasAndCustomActionFields(_0x4830a7,_0x363999,_0x4727c2){const _0x14c221=getUiPropertyMetaToUiPriorities(_0x4830a7,_0x4727c2);let _0x34acc6=[];_0x14c221['forEach'](_0xfe43af=>_0x34acc6['push']({'uiPriority':_0xfe43af['uiPriority'],'uiPropertyMeta':_0xfe43af['uiPropertyMeta']}));if(_0x363999)for(const _0x1a057c of _0x363999){const _0x251869=_0x4830a7['find'](_0x6b3259=>_0x6b3259['name']===_0x1a057c['propertyName']);if(_0x1a057c['propertyName']&&_0x251869){_0x34acc6=_0x34acc6['filter'](_0x207998=>_0x207998['uiPropertyMeta']?.['name']!==_0x1a057c['propertyName']);const _0xd0bbb2=_0x4727c2?.['properties'][_0x1a057c['propertyName']]['ui']?.['priority'];_0x34acc6['push']({'uiPriority':_0x1a057c['priority']??_0xd0bbb2,'customField':_0x1a057c,'uiPropertyMeta':_0x251869});}else _0x34acc6['push']({'uiPriority':_0x1a057c['priority'],'customField':_0x1a057c});}return _0x34acc6;}__name(getSortedUiPropertyMetasAndCustomActionFields,'getSortedUiPropertyMetasAndCustomActionFields');function getUiPropertyMetaToUiPriorities(_0x3815c5,_0x1175f0){const _0x838392=_0x3815c5['map'](_0x3e7ffa=>({'uiPriority':_0x1175f0?.['properties'][_0x3e7ffa['name']]['ui']['priority'],'uiPropertyMeta':_0x3e7ffa}));return _0x838392;}__name(getUiPropertyMetaToUiPriorities,'getUiPropertyMetaToUiPriorities');function getSortedUiPropertyMetas(_0x108b02){return getUiPropertyMetas(_0x108b02)['sort']((_0x102e64,_0x3a6a5c)=>{const _0x1880ec=isIdProperty(_0x3a6a5c)?sortOrders['aBeforeB']:sortOrders['aEqualB'];return isIdProperty(_0x102e64)?sortOrders['aAfterB']:_0x1880ec;});}__name(getSortedUiPropertyMetas,'getSortedUiPropertyMetas');function onItemClick(_0xce292d,_0xc450c8,_0x1e88d0){!isNullOrUndefined(_0xce292d)&&navigateToList(_0xce292d,_0xc450c8,_0x1e88d0['id']);}__name(onItemClick,'onItemClick');

export { getPropertyCssClass, getPropertyMetas, getSortedUiPropertyMetas, getSortedUiPropertyMetasAndCustomActionFields, getUiPropertyMetaToUiPriorities, getUiPropertyMetas, onItemClick, onPropsChange, shouldBeVisible, updateExcludeResourceIds };
