'use strict';
import { crudActions } from '../../../../fd-toolbox/enums/enums.js';
import { isNullOrUndefined } from '../../../../fd-toolbox/functions/value-checking-functions.js';
import { internalTableColumnTypes, tableCustomActionTypes, tableCustomActionPositions } from '../table-models.js';
import { hasCellTemplate, isDateAsTimeAgoInTableConfig } from './fd-table-private-properties.js';
import { hasPropertyPermission } from '../../auth/permissions/permission-checker.js';
import { fillInternalTableColumns, prepareTableAfterColumnsAreCreated, getInternalTableColumnFromPropertyMeta } from './fd-table-private-columns.js';

var __defProp=Object['defineProperty'],__name=(_0x5b6fd7,_0x460f06)=>__defProp(_0x5b6fd7,'name',{'value':_0x460f06,'configurable':!![]});function createColumnsAndPrepareTable(_0x20e773,_0x4484ef,_0x11764f,_0x476b9e,_0x572ea1,_0x31ac61,_0x3253cf,_0xaef01e,_0x4e307c){const _0x45e5db=[];return (_0x31ac61&&Object['keys'](_0x31ac61['resourceMeta']['properties'])['length']>0x2626+0x2*-0x123+0xe0*-0x29||_0x4e307c&&Object['keys'](_0x4e307c?.['properties'])['length']>-0xd0*0x1+-0x11*0x121+0x239*0x9)&&fillInternalTableColumns(_0x45e5db,_0x4484ef,_0x572ea1,_0x11764f,_0x20e773,_0xaef01e,_0x31ac61,_0x4e307c),prepareTableAfterColumnsAreCreated(_0x45e5db,_0x476b9e,_0x3253cf,_0xaef01e),_0x45e5db;}__name(createColumnsAndPrepareTable,'createColumnsAndPrepareTable');function addColumnToInternalTableColumns(_0x54dbb1,_0xaeedff){if(_0xaeedff)_0x54dbb1['push'](_0xaeedff);}__name(addColumnToInternalTableColumns,'addColumnToInternalTableColumns');function createInternalTableColumn(_0x57dd63,_0x276bca,_0x27852a,_0x336674,_0x262c7f,_0x8685a){const _0x5b0163=getInternalTableColumnFromPropertyMeta(_0x57dd63,_0x276bca,_0x27852a,_0x336674),_0x69fc8f=hasPropertyPermission(_0x276bca['id'],crudActions['view']);let _0x5b23b7;hasCellTemplate(_0x262c7f,_0x276bca['name'])&&(_0x5b0163['cellTemplate']=_0x262c7f['columnConfigs'][_0x276bca['name']]['cellTemplate']);isDateAsTimeAgoInTableConfig(_0x262c7f,_0x276bca['name'])&&(_0x5b0163['isDateAsTimeAgo']=!![]);if(shouldAddInternalTableColumn(_0x5b0163,_0x262c7f)&&_0x69fc8f){const _0x27fcd6=!isNullOrUndefined(_0x262c7f['maxNumberOfColumns'])&&_0x8685a['filter'](_0x52a8d1=>_0x52a8d1['type']===internalTableColumnTypes['default']||_0x52a8d1['type']===internalTableColumnTypes['checkMark'])['length']>=_0x262c7f['maxNumberOfColumns'];!_0x27fcd6&&(_0x5b23b7=_0x5b0163);}return _0x5b23b7;}__name(createInternalTableColumn,'createInternalTableColumn');function createActionColumn(_0xf8bf5e,_0x5f5b79,_0x5af902,_0x44cb69,_0x598da3){let _0x2d2f4c={'type':internalTableColumnTypes['action'],'index':_0xf8bf5e,'name':'','displayName':'','width':0x0,'actionPosition':_0x598da3,'actionType':_0x44cb69};shouldAddInternalTableColumn(_0x2d2f4c,_0x5f5b79)&&_0x5af902['push'](_0x2d2f4c);}__name(createActionColumn,'createActionColumn');function addLastActionColumns(_0x1cf02b,_0xdd40a3,_0x3136f5){let _0x3b28b3=_0x1cf02b;const _0x90469f=[tableCustomActionTypes['text'],tableCustomActionTypes['icon'],tableCustomActionTypes['link']];for(const _0x15a7e2 of _0x90469f){_0xdd40a3['customActions']?.['some'](_0x29e66b=>_0x29e66b['position']===tableCustomActionPositions['lastColumn']&&_0x29e66b['actionType']===_0x15a7e2)&&(createActionColumn(_0x1cf02b,_0xdd40a3,_0x3136f5,_0x15a7e2,tableCustomActionPositions['lastColumn']),_0x3b28b3++);}return _0x3b28b3;}__name(addLastActionColumns,'addLastActionColumns');function createCustomHeaderAction(_0x4035b1,_0x27ccad,_0x56b12a){let _0x2f2554={'type':internalTableColumnTypes['customHeaderAction'],'index':_0x4035b1,'name':'','displayName':'','width':0x0,'actionType':tableCustomActionTypes['icon']};shouldAddInternalTableColumn(_0x2f2554,_0x27ccad)&&_0x56b12a['push'](_0x2f2554);}__name(createCustomHeaderAction,'createCustomHeaderAction');function createMultiSelectColumn(_0xb9f5b3){return {'type':internalTableColumnTypes['checkBox'],'index':_0xb9f5b3,'name':'','displayName':'','width':0x0,'hideResizableBar':!![]};}__name(createMultiSelectColumn,'createMultiSelectColumn');function shouldAddInternalTableColumn(_0x2b23da,_0xc356da){return _0xc356da['excludeProperties']&&_0xc356da['excludeProperties']['length']>0x24*0xa9+0x12e2+0x35*-0xce?!_0xc356da['excludeProperties']['includes'](_0x2b23da['name']):!![];}__name(shouldAddInternalTableColumn,'shouldAddInternalTableColumn');

export { addColumnToInternalTableColumns, addLastActionColumns, createActionColumn, createColumnsAndPrepareTable, createCustomHeaderAction, createInternalTableColumn, createMultiSelectColumn };
