'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { getFileName, isIdGetterOnlyImport } from '@flint/infra/analysis';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';

var __defProp=Object['defineProperty'],__name=(_0x2500e5,_0x3cc5e6)=>__defProp(_0x2500e5,'name',{'value':_0x3cc5e6,'configurable':!![]});const ruleName='must-use-funcs-only-for-same-named-component';const ruleContent='\x0a###\x20**Must**\x20import\x20\x27*.funcs.ts\x27\x20files\x20only\x20into\x20the\x20same-named\x20component.\x0a\x0a####\x20Wrong\x0a\x0a//\x20FdList.tsx\x0aimport\x20{\x20getFoo\x20}\x20from\x20\x22./FdView.funcs.ts\x22;\x0a\x0a####\x20Correct\x0a\x0a//\x20FdView.tsx\x0aimport\x20{\x20getFoo\x20}\x20from\x20\x22./FdView.funcs.ts\x22;\x0a\x0a####\x20Why\x0a\x0aThis\x20preserves\x20component\x20encapsulation\x20and\x20prevents\x20hidden\x20dependencies\x20between\x20different\x20components.';var mustUseFuncsOnlyForSameNamedComponent = createEslintRule(ruleName,ruleContent,_0x32d5a9=>{return {'ImportDeclaration'(_0x1674b5){const _0x3278b2=extractFuncsComponentName(_0x1674b5['source']),_0x5f4295=getFileName(_0x32d5a9['filename']),_0x413173=_0x3278b2?_0x3278b2+'.tsx':void(-0x687+-0x2*-0x126b+-0x1e4f);_0x3278b2&&_0x413173&&_0x5f4295!==_0x413173&&!isIdGetterOnlyImport(_0x1674b5['specifiers'])&&_0x32d5a9['report']({'node':_0x1674b5,'messageId':ruleName});}};});function extractFuncsComponentName(_0x16d906){let _0x329d71;if(typeof _0x16d906['value']==='string'){const _0x124b35=getFileName(_0x16d906['value']);if(_0x124b35['endsWith'](flintRuleIdentifiers['funcsTs']))_0x329d71=_0x124b35['slice'](0x1*0xbeb+-0x22*-0x113+-0x3071,-flintRuleIdentifiers['funcsTs']['length']);else _0x124b35['endsWith'](flintRuleIdentifiers['funcs'])&&(_0x329d71=_0x124b35['slice'](-0x1cb7*-0x1+-0x1ddf+0x128,-flintRuleIdentifiers['funcs']['length']));}return _0x329d71;}__name(extractFuncsComponentName,'extractFuncsComponentName');

export { mustUseFuncsOnlyForSameNamedComponent as default, ruleName };
