'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { getFileNamePrefix, nodeTypes, getExportedFunctionNames } from '@flint/infra/analysis';
import { kebabToCamelCasePattern } from '@flint/infra/constants/rules-regex';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';

var __defProp=Object['defineProperty'],__name=(_0x170ff7,_0x2e3b2a)=>__defProp(_0x170ff7,'name',{'value':_0x2e3b2a,'configurable':!![]});const ruleName='must-add-prefix-to-po-functions';const constants={'messageIds':{'mustAddPrefixToPoFunctions':'mustAddPrefixToPoFunctions'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Ensure\x20all\x20exported\x20functions\x20in\x20PO\x20files\x20have\x20proper\x20prefix.'},'messages':{'mustAddPrefixToPoFunctions':'must-add-prefix-to-po-functions\x0a###\x20**Must**\x20add\x20prefix\x20to\x20functions\x20in\x20Page\x20Object\x20files.\x0a\x0a####\x20Wrong\x0a\x0aexport\x20function\x20getFoo()\x20{...}\x0a\x0a####\x20Correct\x0a\x0aexport\x20function\x20browserPoGetFoo()\x20{...}\x0a\x0a####\x20Why\x0a\x0aThis\x20improves\x20clarity\x20and\x20helps\x20with\x20naming\x20conflicts.'},'schema':[]}},createRule=ESLintUtils['RuleCreator'](_0x1cf802=>new URL(_0x1cf802,url)['href']),mustAddPrefixToPoFunctions=createRule({'name':ruleName,'meta':constants['meta'],'create'(_0x282f89){const _0x4c6ccd=_0x282f89['filename'],_0x2d4f1a=/^(.+)-po\.[^.]+$/,_0x29a9b7=getFileNamePrefix(_0x4c6ccd,_0x2d4f1a);if(!_0x29a9b7)return {};return {'ExportNamedDeclaration'(_0x457e80){for(const _0x2c7acb of getExportedFunctionNames(_0x457e80)){checkFunctionName(_0x2c7acb,_0x29a9b7,_0x282f89,_0x457e80);}},'ExportDefaultDeclaration'(_0x250ed3){const _0x534450=_0x250ed3['declaration'];_0x534450['type']===nodeTypes['functionDeclaration']&&_0x534450['id']&&checkFunctionName(_0x534450['id']['name'],_0x29a9b7,_0x282f89,_0x250ed3);}};},'defaultOptions':[]});function toCamelCase(_0x10e580){return _0x10e580['replace'](kebabToCamelCasePattern,(_0x4dceeb,_0x49d5cc)=>_0x49d5cc['toUpperCase']());}__name(toCamelCase,'toCamelCase');function checkFunctionName(_0x53a05f,_0x20d30a,_0x283ba1,_0x53a994){const _0x2361ed=toCamelCase(_0x20d30a)+'Po';!_0x53a05f['startsWith'](_0x2361ed)&&_0x283ba1['report']({'node':_0x53a994,'messageId':constants['messageIds']['mustAddPrefixToPoFunctions'],'data':{'prefix':_0x2361ed,'name':_0x53a05f}});}__name(checkFunctionName,'checkFunctionName');

export { mustAddPrefixToPoFunctions as default, ruleName };
