'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes, isMemberExpression, isIdentifier, isNameMatch, isStringLiteral } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { commonLowerCaseWords } from '../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x3b2729,_0x23d372)=>__defProp(_0x3b2729,'name',{'value':_0x23d372,'configurable':!![]});const ruleName='must-throw-full-error-objects';const ruleId='mustThrowFullErrorObjects';const constants={'meta':{'type':ruleTypes['problem'],'docs':{'description':ruleName},'messages':{[ruleId]:ruleName+'\x0a###\x20**Must**\x20throw\x20full\x20error\x20objects.\x0a\x0a####\x20Wrong\x0a\x0atry\x20{\x0a\x20\x20...\x0a}\x20catch\x20(error)\x20{\x0a\x20\x20throw\x20error\x20instanceof\x20Error\x20?\x20error.message\x20:\x20toolboxErrorMessages.unknown;\x0a}\x0a\x0a####\x20Correct\x0a\x0atry\x20{\x0a\x20\x20...\x0a}\x20catch\x20(error)\x20{\x0a\x20\x20...\x0a\x20\x20throw\x20error;\x0a}\x0a\x0a####\x20Why\x0a\x0aThrowing\x20`error.message`\x20loses\x20stack\x20traces\x20and\x20context,\x20making\x20debugging\x20harder.'},'schema':[]}},propertyNames={'message':commonLowerCaseWords['message']},createRule=ESLintUtils['RuleCreator'](_0x3fde75=>''+url+_0x3fde75),mustThrowFullErrorObjects=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x251a61){return {[nodeTypes['throwStatement']](_0x23eb19){const _0x4bf4d9=_0x23eb19['argument'];if(!_0x4bf4d9)return;let _0x1dfb9b=shouldReportThrownExpression(_0x4bf4d9);_0x1dfb9b&&_0x251a61['report']({'node':_0x23eb19,'messageId':ruleId});}};}});function isMessageMemberExpression(_0x41dfd0){return !!_0x41dfd0&&isMemberExpression(_0x41dfd0)&&isIdentifier(_0x41dfd0['property'])&&isNameMatch(_0x41dfd0['property'],propertyNames['message']);}__name(isMessageMemberExpression,'isMessageMemberExpression');function isDisallowedOperand(_0x517273){return isMessageMemberExpression(_0x517273)||isStringLiteral(_0x517273);}__name(isDisallowedOperand,'isDisallowedOperand');function shouldReportThrownExpression(_0x2ae671){return isDisallowedOperand(_0x2ae671)||_0x2ae671['type']===nodeTypes['conditionalExpression']&&(isDisallowedOperand(_0x2ae671['consequent'])||isDisallowedOperand(_0x2ae671['alternate']))||_0x2ae671['type']===nodeTypes['logicalExpression']&&(isDisallowedOperand(_0x2ae671['left'])||isDisallowedOperand(_0x2ae671['right']));}__name(shouldReportThrownExpression,'shouldReportThrownExpression');

export { mustThrowFullErrorObjects as default, ruleId, ruleName };
