'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { fileExtensionsWithoutDot } from '../../../base-repo/app-constants/internal-system-constants.js';
import { externalPackageNames } from '../../../base-repo/app-constants/command-names.js';
import { jsBasicTypes } from '../../../base-repo/constants/basic-types.js';
import { commonLowerCaseWords, contentFormatNames } from '../../../base-repo/constants/internal-common-strings.js';
import { getFileName } from '@flint/infra/analysis';
import _0x132a45 from 'pluralize';
import { url, ruleTypes } from '@flint/infra/constants/rules-meta';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';
import { wordPluralSuffixes } from '../../../base-repo/constants/strings-constants.js';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x144c07,_0x2c4271)=>__defProp(_0x144c07,'name',{'value':_0x2c4271,'configurable':!![]});const ruleName='must-use-s-ending-for-natural-plurals';const messageId='invalidPluralEnding',createRule=ESLintUtils['RuleCreator'](_0x1e25e7=>''+url+_0x1e25e7),virtualFilename=flintRuleIdentifiers['inputFile'],mostUsedInvalidPlurals=['plaid',fileExtensionsWithoutDot['json'],fileExtensionsWithoutDot['xml'],commonLowerCaseWords['auth'],fileExtensionsWithoutDot['css'],contentFormatNames['html'],'sql','webpack','babel',externalPackageNames['eslint']],mustUseSEndingForNaturalPlurals=createRule({'name':ruleName,'meta':{'type':ruleTypes['problem'],'docs':{'description':'Must\x20use\x20\x27s\x20ending\x20only\x20for\x20words\x20that\x20naturally\x20have\x20a\x20plural\x20form\x20in\x20English'},'messages':{[messageId]:ruleName+'\x0aFile\x20\x22{{fileName}}\x22\x20contains\x20invalid\x20plural\x20\x22{{invalidWord}}\x22\x0a\x0a###\x20**Must**\x20use\x20\x27s\x20ending\x20only\x20for\x20words\x20that\x20naturally\x20have\x20a\x20plural\x20form\x20in\x20English.\x0a\x0a####\x20Wrong\x0a\x0aodata**s**.ts\x0aplaid**s**.ts\x0a\x0a####\x20Correct\x0a\x0aodata.ts\x0aplaid.ts\x0apayment**s**.ts\x0a\x0a####\x20Why\x0a\x0aOnly\x20use\x20the\x20\x27s\x20ending\x20for\x20words\x20that\x20naturally\x20have\x20a\x20plural\x20form\x20in\x20English.\x20Words\x20like\x20\x27odata\x27\x20and\x20\x27plaid\x27\x20don\x27t\x20follow\x20typical\x20pluralization\x20rules,\x20so\x20they\x20should\x20remain\x20singular.\x20This\x20keeps\x20file\x20names\x20clear\x20and\x20consistent.'},'schema':[{'type':'object','properties':{'exceptions':{'type':jsBasicTypes['array'],'items':{'type':'string'},'description':'List\x20of\x20words\x20to\x20exclude\x20from\x20plural\x20checking'}},'additionalProperties':![]}]},'create'(_0x218b8d){const _0x4aadf8=getFileName(_0x218b8d['filename']),_0xa5b847=firstOrUndefined(_0x218b8d['options'])??{},_0x337364=_0xa5b847['exceptions']??[];if(_0x4aadf8!==virtualFilename){const _0x403cf2=hasInvalidPluralEndings(_0x4aadf8,_0x337364);_0x403cf2&&_0x218b8d['report']({'loc':{'line':0x1,'column':0x0},'messageId':messageId,'data':{'fileName':_0x4aadf8,'invalidWord':_0x403cf2}});}return {};},'defaultOptions':[{}]});function hasInvalidPluralEnding(_0x91dad1){if(mostUsedInvalidPlurals['includes'](_0x91dad1))return ![];const _0x597c5a=_0x132a45['singular'](_0x91dad1),_0x1e07e4=_0x132a45['plural'](_0x597c5a);if(mostUsedInvalidPlurals['includes'](_0x597c5a))return !![];if(_0x597c5a['length']<-0x2*-0xd54+0x5ed+-0x1*0x2092)return ![];return _0x1e07e4===_0x597c5a&&!_0x597c5a['endsWith'](wordPluralSuffixes['s']);}__name(hasInvalidPluralEnding,'hasInvalidPluralEnding');function hasInvalidPluralEndings(_0x2883e9,_0xd3219b=[]){const _0x1883ce=getFileName(_0x2883e9),_0x1fed04=firstOrUndefined(_0x1883ce['split']('.'));if(_0x1fed04){if(!(_0xd3219b['includes'](_0x1883ce)||_0xd3219b['includes'](_0x1fed04))){const _0x966e39=_0x1fed04['split']('-');for(const _0x290e43 of _0x966e39){if(_0x290e43['endsWith'](wordPluralSuffixes['s'])&&hasInvalidPluralEnding(_0x290e43))return _0x290e43;}}}return void(0xb4b+-0x1565*0x1+-0x3*-0x35e);}__name(hasInvalidPluralEndings,'hasInvalidPluralEndings');

export { mustUseSEndingForNaturalPlurals as default, ruleName };
