'use strict';
import { reactProperties } from '../constants/component-toolbox-constants.js';
import { isObject } from '../../../fd-toolbox/types/ensure-type.js';
import { first } from '../../../fd-toolbox/server/collections/single-funcs.js';
import { eventListenerEvents } from '../../../fd-toolbox/constants/events.js';

var __defProp=Object['defineProperty'],__name=(_0x367dfe,_0x2b39ee)=>__defProp(_0x367dfe,'name',{'value':_0x2b39ee,'configurable':!![]});function generateLayout(_0x370450,_0x5a3a33,_0x370b6a){if(!_0x370b6a)return;let _0x4d3162=Array['isArray'](_0x370b6a)?_0x370b6a:[_0x370b6a];_0x5a3a33(_0x4d3162['map']((_0x4a6d6d,_0x4ce489)=>createLayoutElement(_0x4a6d6d,_0x4ce489,_0x370450)));}__name(generateLayout,'generateLayout');function onLayoutChange(_0xa686a9,_0x653562){const _0x483681=_0xa686a9['xxs'];_0x653562(_0x3dbdd4=>_0x3dbdd4['map']((_0x5ec729,_0x28ef80)=>({..._0x483681[_0x28ef80],'element':_0x5ec729['element']})));}__name(onLayoutChange,'onLayoutChange');function setupRowHeightListener(_0x857e85,_0x2490c7,_0x51add9){const _0x39eee8=__name(()=>calculateRowHeight(_0x857e85,_0x2490c7,_0x51add9),'updateRowHeight');return _0x39eee8(),window['addEventListener'](eventListenerEvents['resize'],_0x39eee8),()=>{window['removeEventListener'](eventListenerEvents['resize'],_0x39eee8);};}__name(setupRowHeightListener,'setupRowHeightListener');function calculateRowHeight(_0x2eb4a8,_0x8c594c,_0x51dff2){const _0x1988e4=document['querySelector']('.react-grid-layout')?.['clientWidth'];if(_0x1988e4){const _0x16230c=(_0x1988e4-(_0x2eb4a8-(-0xb69*0x1+-0x277+0xde1))*first(_0x51dff2))/_0x2eb4a8;_0x8c594c(_0x16230c);}}__name(calculateRowHeight,'calculateRowHeight');function getProps(_0x865e9d){let _0xb6ed2c={};if(!_0x865e9d)return _0xb6ed2c;if(isObject(_0x865e9d)&&reactProperties['props']in _0x865e9d&&isObject(_0x865e9d['props'])){const _0x1f2a99=_0x865e9d['props'];if(reactProperties['children']in _0x1f2a99&&isObject(_0x1f2a99['children'])){const _0x13b148=_0x1f2a99['children'];if(reactProperties['props']in _0x13b148&&isObject(_0x13b148['props']))return _0xb6ed2c=_0x13b148['props'],_0xb6ed2c;}}return _0xb6ed2c;}__name(getProps,'getProps');function createLayoutElement(_0x57a896,_0x1ad8aa,_0x52bf59){const _0x44e6f4=getProps(_0x57a896),_0x3a4479={'x':_0x44e6f4['defaultX']??_0x1ad8aa%(0x1373*-0x1+-0x757*-0x4+-0x9e4*0x1),'y':_0x44e6f4['defaultY']??-0x111b+0x2225+-0x110a,'w':_0x44e6f4['defaultWidth']??_0x44e6f4['minWidth']??-0x949+0x74f+0x1fb,'h':_0x44e6f4['defaultHeight']??_0x44e6f4['minHeight']??-0x2659*-0x1+0x36b+-0x29c3,'i':_0x44e6f4['id']??_0x1ad8aa['toString'](),'maxH':_0x44e6f4['maxHeight']??Math['round'](_0x52bf59*(0x1*-0xa16+-0x759+0x1171)/(-0x1*0x2011+-0x208f+0x40a3*0x1)),'minH':_0x44e6f4['minHeight'],..._0x44e6f4,'element':_0x57a896};return _0x3a4479;}__name(createLayoutElement,'createLayoutElement');

export { generateLayout, onLayoutChange, setupRowHeightListener };
