'use strict';
import { ESLintUtils, ASTUtils } from '@typescript-eslint/utils';
import { isStringLiteral, nodeTypes, isBinaryExpression } from '@flint/infra/analysis';
import { jsxAttributeNames } from '@flint/infra/constants/eslint-syntax-names';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';

var __defProp=Object['defineProperty'],__name=(_0x5aca75,_0x297aca)=>__defProp(_0x5aca75,'name',{'value':_0x297aca,'configurable':!![]});const ruleName='no-px-in-tailwind';const ruleId='noPxInTailwind';const constants={'meta':{'type':ruleTypes['problem'],'docs':{'description':ruleName},'messages':{[ruleId]:ruleName+'\x0a{{message}}\x0a\x0a###\x20**Must**\x20avoid\x20using\x20`px`\x20values\x20and\x20excessive\x20numeric\x20precision\x20in\x20Tailwind\x20classes.\x0a\x0a####\x20Wrong\x0a\x0a<div\x20className=\x22[10px]\x20bg-red-500\x22\x20/>\x0a\x0a<div\x20className=\x22w-[10.545rem]\x22\x20/>\x0a\x0a####\x20Correct\x0a\x0a<div\x20className=\x22p-2\x20bg-red-500\x22\x20/>\x0a\x0a<div\x20className=\x22w-[10.55rem]\x22\x20/>\x0a\x0a####\x20Why\x0a\x0aTailwind\x20provides\x20a\x20design\x20system\x20of\x20spacing\x20and\x20sizing\x20utilities.\x20Using\x20values\x20with\x20excessive\x20numeric\x20precision\x20will\x20not\x20produce\x20visible\x20differences\x20on\x20the\x20screen.'},'schema':[]},'classNameProp':jsxAttributeNames['stylingClass']},createRule=ESLintUtils['RuleCreator'](_0x2a1ffe=>''+url+_0x2a1ffe),noPxInTailwind=createRule({'name':ruleName,'meta':constants['meta'],'create'(_0x30ca7e){return {'JSXAttribute'(_0x35673b){if(!_0x35673b['name']||_0x35673b['name']['name']!==constants['classNameProp']||!_0x35673b['value'])return;if(isStringLiteral(_0x35673b['value']))checkClassStr(_0x35673b['value']['value'],_0x35673b['value'],_0x30ca7e);else _0x35673b['value']['type']===nodeTypes['JSXExpressionContainer']&&_0x35673b['value']['expression']['type']!==nodeTypes['JSXEmptyExpression']&&processNode(_0x35673b['value']['expression'],_0x30ca7e);}};},'defaultOptions':[]});function getStringValue(_0x5764e4,_0x31fe91){let _0x208759='';const _0x1e505d=ASTUtils['getStaticValue'](_0x5764e4,_0x31fe91['getScope'](_0x5764e4));return _0x1e505d?.['value']&&typeof _0x1e505d['value']==='string'&&(_0x208759=_0x1e505d['value']),_0x208759;}__name(getStringValue,'getStringValue');function reportClasses(_0x24a95f,_0x38210f,_0x54864f,_0x1130a2){_0x1130a2['length']>-0x270e+-0x1bdb+-0x1*-0x42e9&&_0x38210f['report']({'node':_0x24a95f,'messageId':ruleId,'data':{'message':_0x54864f['replace']('{{classes}}',_0x1130a2['join'](',\x20'))}});}__name(reportClasses,'reportClasses');function checkClassStr(_0x16915b,_0x3f3098,_0x50bdf8){const _0x5ef22f=[],_0x1f07cc=[],_0x1579f8=/\[-?\d+\.\d{3,}[^\]]*\]/,_0x1df22e=/\[[^[]+px[^\]]*\]/,_0x3f6335=_0x16915b['split'](/\s+/);for(const _0x5560f5 of _0x3f6335){if(_0x1df22e['test'](_0x5560f5))_0x5ef22f['push'](_0x5560f5);else _0x1579f8['test'](_0x5560f5)&&_0x1f07cc['push'](_0x5560f5);}reportClasses(_0x3f3098,_0x50bdf8,'Using\x20`{{classes}}`\x20is\x20not\x20allowed.\x20Prefer\x20predefined\x20spacing/size\x20utilities\x20like\x20`p-2`,\x20`w-4`.',_0x5ef22f),reportClasses(_0x3f3098,_0x50bdf8,'Using\x20`{{classes}}`\x20is\x20not\x20allowed.\x20Prefer\x20values\x20with\x20no\x20more\x20than\x20two\x20decimal\x20places.',_0x1f07cc);}__name(checkClassStr,'checkClassStr');function processNode(_0x26a576,_0x302e8a){if(_0x26a576['type']===nodeTypes['literal']||_0x26a576['type']===nodeTypes['templateLiteral']||_0x26a576['type']===nodeTypes['identifier']||_0x26a576['type']===nodeTypes['memberExpression']){const _0x2b4a50=getStringValue(_0x26a576,_0x302e8a['sourceCode']);if(_0x2b4a50)checkClassStr(_0x2b4a50,_0x26a576,_0x302e8a);}else {if(_0x26a576['type']===nodeTypes['callExpression'])for(const _0x3d4620 of _0x26a576['arguments']){processNode(_0x3d4620,_0x302e8a);}else (_0x26a576['type']===nodeTypes['logicalExpression']||isBinaryExpression(_0x26a576))&&(processNode(_0x26a576['left'],_0x302e8a),processNode(_0x26a576['right'],_0x302e8a));}}__name(processNode,'processNode');

export { noPxInTailwind as default, ruleId, ruleName };
