'use strict';
import { tableCustomActionTypes, internalTableColumnTypes } from '../table-models.js';
import { hasCellTemplate, ifShouldStopAddingColumns, ifShouldDisplayPropertyInList } from './fd-table-private-properties.js';
import { calculateAndSetColumnDimensions } from './fd-table-private-column-calculation.js';
import { resourceNames } from '../../../../fd-toolbox/resources/resource-names.js';
import { getObjectValues } from '../../../../fd-toolbox/lib/utils.js';
import { createMultiSelectColumn, createCustomHeaderAction, createActionColumn, addLastActionColumns, addColumnToInternalTableColumns, createInternalTableColumn } from './fd-table-private-create-columns.js';
import { tableDisplayModes, propertyTypes } from '../../../../fd-toolbox/enums/enums.js';
import { isFlagsEnum } from '../../core/property-types.js';

var __defProp=Object['defineProperty'],__name=(_0x22560e,_0x107316)=>__defProp(_0x22560e,'name',{'value':_0x107316,'configurable':!![]});function fillInternalTableColumns(_0x336041,_0x47b6da,_0x25368e,_0x44a32b,_0x3e2294,_0x1ffa3d=tableDisplayModes['default'],_0x2a073a,_0x326d9d){let _0x4fc2f8=0x9*-0x2c9+0xe8*0xb+-0x305*-0x5;_0x3e2294['multiSelect']&&(_0x336041['push'](createMultiSelectColumn(_0x4fc2f8)),_0x4fc2f8++),!_0x47b6da&&_0x2a073a&&(_0x2a073a['resourceMeta']['resourceName']===resourceNames['product']&&_0x4fc2f8===0xd48+0x2392+-0x30da?createCustomHeaderAction(_0x4fc2f8,_0x3e2294,_0x336041):createActionColumn(_0x4fc2f8,_0x3e2294,_0x336041,tableCustomActionTypes['icon']),_0x4fc2f8++),_0x4fc2f8=getInternalTableColumns(_0x4fc2f8,_0x2a073a,_0x336041,_0x25368e,_0x44a32b,_0x3e2294,_0x1ffa3d,_0x326d9d),_0x4fc2f8++,addLastActionColumns(_0x4fc2f8,_0x3e2294,_0x336041);}__name(fillInternalTableColumns,'fillInternalTableColumns');function getInternalTableColumns(_0x223b0e,_0x4aae32,_0x283910,_0x1bff75,_0x4c0985,_0x4b8b08,_0x11661a,_0x536133){let _0x4ead01=_0x223b0e;if(_0x536133)for(const _0x5a62f3 of getObjectValues(_0x536133['properties'])){const _0x5c7363={'name':_0x5a62f3['name'],'itemPropertyName':_0x5a62f3['name'],'displayName':_0x5a62f3['displayName'],'type':internalTableColumnTypes['default'],'width':0x0,'index':_0x4ead01,'priority':_0x5a62f3['priority'],'propertyType':_0x5a62f3['propertyType'],'propertyTypeFormat':_0x5a62f3['typeFormat'],'enumInfo':_0x5a62f3['enumInfo'],'cellTemplate':_0x5a62f3['cellTemplate']};_0x4ead01++,addColumnToInternalTableColumns(_0x283910,_0x5c7363);}const _0x51f811=_0x4aae32?_0x4aae32['properties']:{};for(const _0x2e2fd4 of getObjectValues(_0x51f811)){if(_0x2e2fd4['isListDisplayable']||hasCellTemplate(_0x4b8b08,_0x2e2fd4['name'])||_0x2e2fd4['isSearchable']){if(!ifShouldStopAddingColumns(_0x4ead01,_0x11661a,_0x4b8b08,_0x2e2fd4)){const _0x49afce=_0x4aae32['resourceMeta']['properties'][_0x2e2fd4['name']];if(ifShouldDisplayPropertyInList(_0x2e2fd4,_0x49afce,_0x4c0985,_0x4b8b08)||_0x4b8b08['includeProperties']?.['some'](_0x477238=>_0x2e2fd4['name']===_0x477238)){const _0x47ddff=createInternalTableColumn(_0x2e2fd4,_0x49afce,_0x4ead01,_0x1bff75,_0x4b8b08,_0x283910);_0x4ead01++,addColumnToInternalTableColumns(_0x283910,_0x47ddff);}}}}return _0x4ead01;}__name(getInternalTableColumns,'getInternalTableColumns');function prepareTableAfterColumnsAreCreated(_0x5d3da2,_0x3d4c19,_0x1d81fe,_0x206ab7){for(const _0x2a84bc of _0x5d3da2){if(_0x2a84bc['propertyMeta']?.['enumerationDisplayName']){let _0x30dcba=new Map();for(const _0x353795 of _0x2a84bc['propertyMeta']['enumerationDisplayName']){let _0x25824b=_0x2a84bc['propertyMeta']['enumerationDisplayName']['indexOf'](_0x353795);isFlagsEnum(_0x2a84bc['propertyType'],_0x2a84bc['propertyTypeFormat'])&&(_0x25824b=_0x2a84bc['propertyMeta']['enumerationValues'][_0x25824b]),_0x30dcba['set'](_0x25824b,_0x353795);}_0x3d4c19['set'](_0x2a84bc['propertyMeta']['name'],_0x30dcba);}}setColumnDimensions(_0x5d3da2,_0x1d81fe,_0x206ab7);}__name(prepareTableAfterColumnsAreCreated,'prepareTableAfterColumnsAreCreated');function getInternalTableColumnFromPropertyMeta(_0x1758f8,_0x4e0545,_0x22c26f,_0x316b42){const _0x26fd38={'index':_0x22c26f,'propertyMeta':_0x4e0545,'uiPropertyMeta':_0x1758f8,'priority':_0x4e0545['ui']['priority'],'name':'','displayName':'','type':internalTableColumnTypes['default'],'width':0x0,'propertyType':_0x4e0545['type'],'propertyTypeFormat':_0x4e0545['typeFormat']};return _0x4e0545['relation']&&_0x4e0545['relation']['expandForDescription']&&_0x316b42['length']?fillInternalTableColumnForMetaExpands(_0x26fd38,_0x4e0545,_0x316b42):(_0x26fd38['name']=_0x1758f8['name'],_0x26fd38['itemPropertyName']=_0x1758f8['name'],_0x26fd38['displayName']=_0x4e0545['displayName']),_0x4e0545['type']===propertyTypes['boolean']?_0x26fd38['type']=internalTableColumnTypes['checkMark']:_0x26fd38['type']=internalTableColumnTypes['default'],_0x26fd38;}__name(getInternalTableColumnFromPropertyMeta,'getInternalTableColumnFromPropertyMeta');function setColumnDimensions(_0x17973d,_0x22d5ec,_0x54a6a8){if(!_0x22d5ec)return;let _0x5341d9;_0x54a6a8===tableDisplayModes['minimal']?_0x5341d9=-0x860+-0x36e*0x9+0xd15*0x3+0.5:_0x5341d9=0x1e34+-0xcfb*-0x1+-0x1*0x2b2d,calculateAndSetColumnDimensions(_0x17973d,_0x22d5ec,_0x5341d9);}__name(setColumnDimensions,'setColumnDimensions');function fillInternalTableColumnForMetaExpands(_0x1c0703,_0x5b78f7,_0x8f9654){let _0x17979c=_0x8f9654['find'](_0x1086d0=>_0x1086d0['resourceName']===_0x5b78f7['relation']['relatedResourceName']);_0x1c0703['displayName']=_0x5b78f7['displayName'],_0x1c0703['name']=_0x5b78f7['name'],_0x1c0703['expandInfo']={'relatedItemName':_0x5b78f7['relation']['relatedResourceName'],'expandPropertyName':_0x5b78f7['relation']['expandPropertyName'],'resourceMeta':_0x17979c};}__name(fillInternalTableColumnForMetaExpands,'fillInternalTableColumnForMetaExpands');

export { fillInternalTableColumns, getInternalTableColumnFromPropertyMeta, getInternalTableColumns, prepareTableAfterColumnsAreCreated };
