'use strict';
import { nodeTypes } from '@flint/infra/analysis/function-analysis';
import { first } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x1b3435,_0x6f3904)=>__defProp(_0x1b3435,'name',{'value':_0x6f3904,'configurable':!![]});function getIndentSize(_0x22f8a3,_0x2a06f5){const _0x3368b7='\x20'['repeat'](0x12a*-0xa+0x1eb4+-0x1*0x130c);let _0x1f2d57=_0x3368b7;if(_0x2a06f5){const _0x425f1e=_0x22f8a3['getText'](_0x2a06f5),_0x468807=/^\s*/,_0xfa91d7=_0x468807['exec'](_0x425f1e);_0xfa91d7?_0x1f2d57=formatIndent(first(_0xfa91d7)):_0x1f2d57='';}else {const _0x4088f8=/^( +|\t+)/,_0x36aa69=_0x22f8a3['getText']()['split']('\x0a');for(const _0xe3f936 of _0x36aa69){const _0x282aad=_0x4088f8['exec'](_0xe3f936);if(_0x282aad){_0x1f2d57=formatIndent(first(_0x282aad));break;}}}return _0x1f2d57;}__name(getIndentSize,'getIndentSize');function isExprNeedsBrackets(_0x469e98){switch(_0x469e98['type']){case nodeTypes['logicalExpression']:case nodeTypes['conditionalExpression']:case nodeTypes['assignmentExpression']:case nodeTypes['sequenceExpression']:return !![];case nodeTypes['unaryExpression']:return isExprNeedsBrackets(_0x469e98['argument']);default:return ![];}}__name(isExprNeedsBrackets,'isExprNeedsBrackets');function formatCondition(_0x449d30,_0x346ad0){const _0x5e6cf1=_0x346ad0['getText'](_0x449d30);return isExprNeedsBrackets(_0x449d30)?'('+_0x5e6cf1+')':_0x5e6cf1;}__name(formatCondition,'formatCondition');function formatIndent(_0xb6c3b9){let _0x34b739;return _0xb6c3b9['includes']('\x09')?_0x34b739='\x09'['repeat'](_0xb6c3b9['length']):_0x34b739='\x20'['repeat'](_0xb6c3b9['length']),_0x34b739;}__name(formatIndent,'formatIndent');

export { formatCondition, getIndentSize, isExprNeedsBrackets };
