'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import * as _0x1869d0 from 'path';
import * as _0x3881d1 from 'fs';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { externalPackageNames } from '../../../base-repo/app-constants/command-names.js';
import { files } from '../../../base-repo/app-constants/project-paths.js';
import { fileExtensions, stringEncodingNames } from '../../../base-repo/app-constants/internal-system-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x555532,_0x43e863)=>__defProp(_0x555532,'name',{'value':_0x43e863,'configurable':!![]});const ruleName='must-not-import-react';const forbiddenImports=[externalPackageNames['react'],externalPackageNames['reactDom'],externalPackageNames['reactJsxRuntime']],constants={'messageIds':{'mustNotImportReact':'mustNotImportReact'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Disallow\x20importing\x20React\x20in\x20*.func.ts\x20files\x20or\x20any\x20dependency\x20that\x20imports\x20React'},'messages':{'mustNotImportReact':ruleName+'\x0a###\x20**Must\x20not**\x20import\x20React\x20in\x20func\x20files.\x0a\x0a####\x20Wrong\x0a\x0a//\x20bar.func.ts\x0aimport\x20React\x20from\x20\x22react\x22;\x0a\x0a//\x20bar.func.ts\x0aimport\x20{\x20getBaz\x20}\x20from\x20\x22bazFile.ts\x22;\x20//\x20bazFile\x20imports\x20React\x0a\x0a//\x20bar.func.ts\x0aimport\x20{\x20getFoo\x20}\x20from\x20\x22fooFile.ts\x22;\x20//\x20fooFile\x20imports\x20bazFile\x20that\x20imports\x20React\x0a\x0a####\x20Correct\x0a\x0a//\x20bar.func.ts\x0a//\x20doesn’t\x20import\x20React\x0aimport\x20{\x20getBaz\x20}\x20from\x20\x22bazFile.ts\x22;\x20//\x20bazFile\x20doesn’t\x20import\x20React\x0aimport\x20{\x20getFoo\x20}\x20from\x20\x22fooFile.ts\x22;\x20//\x20fooFile\x20doesn’t\x20import\x20bazFile\x20that\x20imports\x20React\x0a\x0a####\x20Why\x0a\x0aSeparates\x20component\x20dependencies,\x20avoids\x20cyclical\x20dependencies.'},'schema':[]}},createRule=ESLintUtils['RuleCreator'](_0x1d2315=>''+url+_0x1d2315),fileCache=new Map(),mustNotImportReact=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x3c6fe9){const _0xfdb1ae=_0x3c6fe9['filename'];if(!/\.func\.(ts|tsx)$/['test'](_0xfdb1ae))return {};return {'ImportDeclaration'(_0x59ceb9){const _0x384169=_0x59ceb9['source']['value'];if(typeof _0x384169!=='string')return;if(forbiddenImports['includes'](_0x384169['toLowerCase']())){_0x3c6fe9['report']({'node':_0x59ceb9,'messageId':constants['messageIds']['mustNotImportReact']});return;}if(_0x384169['startsWith']('.')){const _0xfe409e=resolveFilePath(_0x384169,_0x1869d0['dirname'](_0xfdb1ae));_0xfe409e&&fileImportsReact(_0xfe409e)&&_0x3c6fe9['report']({'node':_0x59ceb9,'messageId':constants['messageIds']['mustNotImportReact']});}}};}});function resolveFilePath(_0x596a55,_0x34fe43){if(!_0x596a55['startsWith']('.'))return void(-0xf2+0x1ab8+-0x2*0xce3);const _0x25d115=_0x1869d0['resolve'](_0x34fe43,_0x596a55),_0x36a962=[fileExtensions['ts'],fileExtensions['tsx'],fileExtensions['js'],fileExtensions['jsx']],_0x5454c8=[_0x25d115,..._0x36a962['map'](_0x4f1e5b=>_0x25d115+_0x4f1e5b),_0x1869d0['join'](_0x25d115,files['indexTs']),_0x1869d0['join'](_0x25d115,files['indexTsx']),_0x1869d0['join'](_0x25d115,files['indexJs']),_0x1869d0['join'](_0x25d115,files['indexJsx'])];return _0x5454c8['find'](_0x555184=>_0x3881d1['existsSync'](_0x555184))??void(0xa26*-0x3+-0x13cc+0x2*0x191f);}__name(resolveFilePath,'resolveFilePath');function fileImportsReact(_0x3a6f3c,_0x1814da=new Set()){let _0x47b3f1=![];if(fileCache['has'](_0x3a6f3c))_0x47b3f1=fileCache['get'](_0x3a6f3c)??![];else {if(!_0x1814da['has'](_0x3a6f3c)&&_0x3881d1['existsSync'](_0x3a6f3c)){_0x1814da['add'](_0x3a6f3c);const _0x3b4447=_0x3881d1['readFileSync'](_0x3a6f3c,stringEncodingNames['utfDash8']),_0x99fb25=/from\s+['"]react['"]/,_0x3fb19f=/import\s+[\s\S]{0,200}?from\s+['"]([^'"]{1,200})['"]/g;if(_0x99fb25['test'](_0x3b4447))_0x47b3f1=!![];else for(const _0x571f14 of _0x3b4447['matchAll'](_0x3fb19f)){const _0x4a03df=_0x571f14[0x824+-0x4*-0x8c7+-0x2b3f],_0x18825d=resolveFilePath(_0x4a03df,_0x1869d0['dirname'](_0x3a6f3c));if(_0x18825d&&fileImportsReact(_0x18825d,_0x1814da)){_0x47b3f1=!![];break;}}}}return fileCache['set'](_0x3a6f3c,_0x47b3f1),_0x47b3f1;}__name(fileImportsReact,'fileImportsReact');

export { mustNotImportReact as default, ruleName };
