'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { isTestFile } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { jsBasicTypes } from '../../../base-repo/constants/basic-types.js';
import { commonLowerCaseWords, userConstants } from '../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x470d80,_0x374eb0)=>__defProp(_0x470d80,'name',{'value':_0x374eb0,'configurable':!![]});const ruleName='must-use-example-domain';const constants={'messageIds':{'invalidEmailDomain':'invalidEmailDomain'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Test\x20email\x20addresses\x20must\x20use\x20@example.com\x20domain'},'messages':{'invalidEmailDomain':'must-use-example-domain\x0aEmail\x20address\x20must\x20use\x20@example.com\x20domain:\x20\x27{{\x20email\x20}}\x27\x20is\x20not\x20allowed.\x0a\x0a###\x20**Must**\x20write\x20test\x20emails\x20with\x20example.com\x20domain.\x0a\x0a####\x20Wrong\x0a\x0afoo@test.com\x0a\x0a####\x20Correct\x0a\x0afoo@example.com\x0a\x0a####\x20Why\x0a\x0aExample.com\x20is\x20a\x20special\x20domain\x20for\x20testing.\x20Someone\x20owns\x20test.com\x20domain.'},'schema':[]},'email':{'requiredDomain':userConstants['atExampleDomain']},'types':{'string':jsBasicTypes['string']},'nodeKeys':{'value':commonLowerCaseWords['value']}},createRule=ESLintUtils['RuleCreator'](_0x40f184=>''+url+_0x40f184),mustUseExampleDomain=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x4192ea){const _0x552e9f=_0x4192ea['filename'];let _0x4d6312={};return isTestFile(_0x552e9f)&&(_0x4d6312={'Literal'(_0x4c386c){const _0x3f51ef=_0x4c386c[constants['nodeKeys']['value']];typeof _0x3f51ef==='string'&&reportInvalidEmails(_0x3f51ef,_0x4c386c,_0x4192ea);}}),_0x4d6312;}});function reportInvalidEmails(_0x17d7fd,_0xed8618,_0x517b40){const _0x12256f=_0x17d7fd['split'](/@/g)['length']-(0x4*0x595+-0xdfc+0x1*-0x857),_0x186180=/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/,_0xe8890f=_0x186180['test'](_0x17d7fd['trim']()),_0x47ea0a=_0xe8890f&&_0x12256f===-0x175d+-0x1262+0x29c0&&!_0x17d7fd['startsWith']('@')&&!_0x17d7fd['endsWith'](constants['email']['requiredDomain']);_0x47ea0a&&_0x517b40['report']({'node':_0xed8618,'messageId':constants['messageIds']['invalidEmailDomain'],'data':{'email':_0x17d7fd}});}__name(reportInvalidEmails,'reportInvalidEmails');

export { mustUseExampleDomain as default, ruleName };
