'use strict';
import { tableDisplayModes } from '../../../../fd-toolbox/enums/enums.js';
import { internalTableColumnTypes } from '../table-models.js';
import { resizeColumnEventTarget } from '../services/fd-table-private-resize-columns.js';
import { resizeColumnEventType } from '../table-constants.js';
import { getElementId } from '../../../../fd-toolbox/html/element-ids.js';
import { elements } from '../../../../fd-toolbox/constants/elements.js';
import { elementPrefixes } from '../../constants/element-prefixes.js';

var __defProp=Object['defineProperty'],__name=(_0x55dc67,_0x4decc5)=>__defProp(_0x55dc67,'name',{'value':_0x4decc5,'configurable':!![]});function onInitTableBody(_0x5c00d8,_0xa960c5,_0x35ddd5,_0x2ac5ad,_0x2de609,_0xe41a4f){let _0x1f6b6b=[],_0x44dada=[];if(_0x2de609){_0xa960c5(_0x5c00d8);for(let _0x5a008a of _0x2de609['tableInstance']['internalTableColumns']){_0x1f6b6b['push'](getCellContext(_0x5a008a,_0x2de609)),_0x44dada['push'](getBodyCellClasses(_0xe41a4f,_0x5a008a));}_0x35ddd5(_0x1f6b6b),_0x2ac5ad(_0x44dada);}else _0x2ac5ad([getBodyCellClasses(_0xe41a4f)]);resizeColumnEventTarget['addEventListener'](resizeColumnEventType,_0x4a6d07=>{if(isResizeColumnEvent(_0x4a6d07)){const _0x365a76=_0x4a6d07['detail'];resizeColumnWidth(_0x365a76['width'],_0x365a76['index'],_0x1f6b6b);}});}__name(onInitTableBody,'onInitTableBody');function onRowClick(_0x180c16){_0x180c16&&_0x180c16['tableInstance']['multiSelect']&&_0x180c16['tableInstance']['onRowClicked']&&_0x180c16['tableInstance']['onRowClicked'](_0x180c16['row']['item']);}__name(onRowClick,'onRowClick');function getRowId(_0x4252db,_0xd4e547,_0x339dfd){return getElementId(getRowParentId(_0xd4e547),_0x339dfd??'',_0x4252db??'');}__name(getRowId,'getRowId');function handleRowClick(_0x1a6931,_0x4ae9c2){onRowClick(_0x1a6931),_0x1a6931?.['row']?.['item']&&_0x4ae9c2?.(_0x1a6931['row']['item']);}__name(handleRowClick,'handleRowClick');function applyResizableTableBodyLayout(_0x53fc21,_0x449fe0){if(!_0x53fc21||_0x53fc21['length']===-0x1ec8+0x19*-0x3d+-0x5*-0x759)return;const _0x591352=_0x53fc21['reduce']((_0x295097,_0x1379bb)=>_0x295097+_0x1379bb,-0x4ed*0x6+0xc78*0x2+-0x6*-0xc5),_0x16bec5=[..._0x53fc21];_0x591352<-0x1*0xa02+0x33*-0xb3+0x2e0f&&(_0x16bec5[_0x16bec5['length']-(-0x118c+-0x13e4+-0x47*-0x87)]+=-0x4*0x2ab+0xbb4+0x1*-0xa4-_0x591352),_0x449fe0(_0x16bec5);}__name(applyResizableTableBodyLayout,'applyResizableTableBodyLayout');function resizeColumnWidth(_0x3133c0,_0x26929d,_0x269de0){_0x269de0[_0x26929d]?.['internalTableColumn']&&(_0x269de0[_0x26929d]['internalTableColumn']['width']=_0x3133c0);}__name(resizeColumnWidth,'resizeColumnWidth');function isResizeColumnEvent(_0x341134){return _0x341134 instanceof CustomEvent;}__name(isResizeColumnEvent,'isResizeColumnEvent');function isCheckboxCell(_0x36112f){return _0x36112f['type']===internalTableColumnTypes['checkBox'];}__name(isCheckboxCell,'isCheckboxCell');function isActionCell(_0xf04dc){return _0xf04dc['type']===internalTableColumnTypes['action']||_0xf04dc['type']===internalTableColumnTypes['customHeaderAction'];}__name(isActionCell,'isActionCell');function getBodyCellClasses(_0x2bc17a,_0x348011){let _0x4c31ca=_0x2bc17a===tableDisplayModes['minimal']?'box-content\x20w-full\x20px-1':'box-content\x20w-full';return _0x348011&&(isCheckboxCell(_0x348011)&&(_0x4c31ca='min-w-4\x20px-0'),isActionCell(_0x348011)&&(_0x4c31ca=_0x2bc17a===tableDisplayModes['minimal']?'relative\x20box-border\x20flex\x20w-full\x20flex-row\x20items-center\x20justify-center\x20px-1.5':'relative\x20box-border\x20flex\x20w-full\x20flex-row\x20items-center\x20justify-center')),_0x4c31ca;}__name(getBodyCellClasses,'getBodyCellClasses');function getCellContext(_0x3b5703,_0x2a1d5f){const _0x154a64={'row':_0x2a1d5f['row'],'internalTableColumn':_0x3b5703,'tableInstance':_0x2a1d5f['tableInstance']};return _0x154a64;}__name(getCellContext,'getCellContext');function getRowParentId(_0x17f204){const _0x2b37e7=_0x17f204?.['tableInstance']?.['id']??'';let _0x370c92=_0x2b37e7;if(_0x2b37e7['startsWith'](elements['multiBrowser']['rightTable'])){const _0x20cf37=getMultiBrowserInstanceNumber(_0x2b37e7,elements['multiBrowser']['rightTable']);_0x370c92=getElementId(elements['table']['tableElementId'],elementPrefixes['right'],_0x20cf37);}else {if(_0x2b37e7['startsWith'](elements['multiBrowser']['leftTable'])){const _0x5e05d2=getMultiBrowserInstanceNumber(_0x2b37e7,elements['multiBrowser']['leftTable']);_0x370c92=getElementId(elements['table']['tableElementId'],elementPrefixes['left'],_0x5e05d2);}}return _0x370c92;}__name(getRowParentId,'getRowParentId');function getMultiBrowserInstanceNumber(_0x18a4b6,_0x52a54b){const _0x266860=_0x18a4b6['slice'](_0x52a54b['length'])['replace'](/^-/,'');return _0x266860??0x700+-0x109+-0x1fd*0x3;}__name(getMultiBrowserInstanceNumber,'getMultiBrowserInstanceNumber');

export { applyResizableTableBodyLayout, getRowId, handleRowClick, onInitTableBody, onRowClick };
