'use strict';const _0xe2f930=_0x449d;(function(_0x44162e,_0xac8747){const _0x3653f8=_0x449d,_0x19c8a2=_0x44162e();while(!![]){try{const _0x54a2e2=-parseInt(_0x3653f8(0xcf))/0x1*(parseInt(_0x3653f8(0xad))/0x2)+-parseInt(_0x3653f8(0x71))/0x3+-parseInt(_0x3653f8(0x94))/0x4+parseInt(_0x3653f8(0xc2))/0x5+-parseInt(_0x3653f8(0xa4))/0x6+-parseInt(_0x3653f8(0xb4))/0x7+parseInt(_0x3653f8(0xba))/0x8*(parseInt(_0x3653f8(0xc3))/0x9);if(_0x54a2e2===_0xac8747)break;else _0x19c8a2['push'](_0x19c8a2['shift']());}catch(_0x3fd301){_0x19c8a2['push'](_0x19c8a2['shift']());}}}(_0x12ba,0x197d4));var __decorate=this&&this[_0xe2f930(0x80)]||function(_0x266578,_0x5214e5,_0x87df0c,_0x4b8cfa){const _0x2e4fc6=_0xe2f930;var _0x36e20f=arguments[_0x2e4fc6(0x7d)],_0x37055f=_0x36e20f<0x3?_0x5214e5:_0x4b8cfa===null?_0x4b8cfa=Object['getOwnPropertyDescriptor'](_0x5214e5,_0x87df0c):_0x4b8cfa,_0xd362a0;if(typeof Reflect==='object'&&typeof Reflect['decorate']===_0x2e4fc6(0xb2))_0x37055f=Reflect['decorate'](_0x266578,_0x5214e5,_0x87df0c,_0x4b8cfa);else{for(var _0x506149=_0x266578[_0x2e4fc6(0x7d)]-0x1;_0x506149>=0x0;_0x506149--)if(_0xd362a0=_0x266578[_0x506149])_0x37055f=(_0x36e20f<0x3?_0xd362a0(_0x37055f):_0x36e20f>0x3?_0xd362a0(_0x5214e5,_0x87df0c,_0x37055f):_0xd362a0(_0x5214e5,_0x87df0c))||_0x37055f;}return _0x36e20f>0x3&&_0x37055f&&Object[_0x2e4fc6(0x98)](_0x5214e5,_0x87df0c,_0x37055f),_0x37055f;},__metadata=this&&this[_0xe2f930(0x91)]||function(_0x4f22f9,_0x3ac9cf){const _0x2e92cf=_0xe2f930;if(typeof Reflect===_0x2e92cf(0xb1)&&typeof Reflect[_0x2e92cf(0x73)]===_0x2e92cf(0xb2))return Reflect[_0x2e92cf(0x73)](_0x4f22f9,_0x3ac9cf);},__param=this&&this[_0xe2f930(0xbe)]||function(_0x5c702c,_0x1e7301){return function(_0x5a8816,_0x2c1cce){_0x1e7301(_0x5a8816,_0x2c1cce,_0x5c702c);};};Object[_0xe2f930(0x98)](exports,'__esModule',{'value':!![]}),exports[_0xe2f930(0xac)]=void 0x0;function _0x449d(_0xd1d90f,_0x10c39c){const _0x12ba19=_0x12ba();return _0x449d=function(_0x449d9e,_0x253f38){_0x449d9e=_0x449d9e-0x66;let _0x39c38a=_0x12ba19[_0x449d9e];return _0x39c38a;},_0x449d(_0xd1d90f,_0x10c39c);}const globalConfig_service_1=require('../globalConfig/globalConfig.service'),common_1=require(_0xe2f930(0x84)),badwords_entity_1=require(_0xe2f930(0xbf)),typeorm_1=require('typeorm'),typeorm_2=require(_0xe2f930(0xce)),axios_1=require(_0xe2f930(0x7e)),violationLog_entity_1=require(_0xe2f930(0x76)),user_entity_1=require(_0xe2f930(0xc6)),utils_1=require('../../common/utils');let BadwordsService=class BadwordsService{constructor(_0x38b8c0,_0x40b251,_0x3df024,_0x3e259b){const _0x151e54=_0xe2f930;this[_0x151e54(0x68)]=_0x38b8c0,this[_0x151e54(0xca)]=_0x40b251,this[_0x151e54(0xbd)]=_0x3df024,this[_0x151e54(0x6c)]=_0x3e259b,this[_0x151e54(0xa1)]=[];}async['onModuleInit'](){const _0x5235ef=_0xe2f930;this[_0x5235ef(0x8e)]();}async[_0xe2f930(0x7b)](_0x3aa2a3,_0x706980){const _0x2a6ec7=_0xe2f930,_0x2f4d31=[];for(let _0x18d864=0x0;_0x18d864this[_0x267d56(0x69)](_0x48eb1e[_0x267d56(0x83)])))];await this[_0x267d56(0x67)](_0x575eaf,_0x351214,['***'],_0x30fa95,_0x267d56(0xb6));const _0x17c06e=_0x267d56(0xa0)+_0x30fa95['join'](',')+'的内容、我们已对您的账户进行标记、请合规使用!';throw new common_1[(_0x267d56(0xa6))](_0x17c06e,common_1['HttpStatus'][_0x267d56(0xa8)]);}}async['nineaiCheckBadWords'](_0x572dfa,_0x37b178,_0x7f6e08){const _0x3311e9=_0xe2f930;var _0x90e041;const {nineaiBuiltInSensitiveApiBase:_0x1cd4ad,nineaiBuiltInSensitiveAuthKey:_0x3985e4}=_0x37b178;if(!_0x1cd4ad||!_0x3985e4)return;const _0x5bbc15=await axios_1[_0x3311e9(0x7a)][_0x3311e9(0x6e)](_0x1cd4ad,{'content':_0x572dfa},{'headers':{'Content-Type':_0x3311e9(0x88),'Authorization':_0x3985e4}});if(!_0x5bbc15[_0x3311e9(0xd0)])return;if(_0x5bbc15[_0x3311e9(0xd0)][_0x3311e9(0x86)]!=='0'){const {msg:msg=_0x3311e9(0x8c)}=_0x5bbc15[_0x3311e9(0xd0)];throw new common_1[(_0x3311e9(0xa6))](_0x3311e9(0xbc)+msg,common_1[_0x3311e9(0xa7)][_0x3311e9(0xa8)]);}if(_0x5bbc15[_0x3311e9(0xd0)][_0x3311e9(0x9d)]&&((_0x90e041=_0x5bbc15['data'][_0x3311e9(0x9d)])===null||_0x90e041===void 0x0?void 0x0:_0x90e041[_0x3311e9(0x7d)])){const _0x1a77e1=[...new Set(_0x5bbc15[_0x3311e9(0xd0)][_0x3311e9(0x9d)]['map'](_0x5e0886=>_0x5e0886[_0x3311e9(0xa9)]))],_0x20f478=[...new Set(_0x5bbc15['data'][_0x3311e9(0x9d)]['map'](_0x2293a5=>_0x2293a5['category']))];await this[_0x3311e9(0x67)](_0x7f6e08,_0x572dfa,_0x1a77e1,_0x20f478,_0x3311e9(0x97));const _0x44c255=this[_0x3311e9(0xb7)](_0x5bbc15[_0x3311e9(0xd0)][_0x3311e9(0x9d)]);throw new common_1[(_0x3311e9(0xa6))](_0x44c255,common_1[_0x3311e9(0xa7)]['BAD_REQUEST']);}}[_0xe2f930(0xb7)](_0x6e42e9){const _0x4353b5=_0xe2f930,_0x468b3a=_0x6e42e9[_0x4353b5(0x96)](_0x5ec069=>_0x5ec069['category']),_0x442d5f=[...new Set(_0x468b3a)];return _0x4353b5(0x6b)+_0x442d5f[_0x4353b5(0xae)](',')+_0x4353b5(0x89);}async[_0xe2f930(0x8e)](){const _0x24963c=_0xe2f930,_0x3deeca=await this[_0x24963c(0x68)][_0x24963c(0x8b)]({'where':{'status':0x1},'select':[_0x24963c(0xcc)]});this[_0x24963c(0xa1)]=_0x3deeca['map'](_0xfb2750=>_0xfb2750[_0x24963c(0xcc)]);}async[_0xe2f930(0xaf)](_0x57a2e0){const _0x2c0ce7=_0xe2f930,{page:page=0x1,size:size=0x1f4,word:_0x2863d5,status:_0x54d0bb}=_0x57a2e0,_0x9498e1={};[0x0,0x1,'0','1'][_0x2c0ce7(0xd7)](_0x54d0bb)&&(_0x9498e1[_0x2c0ce7(0x70)]=_0x54d0bb),_0x2863d5&&(_0x9498e1[_0x2c0ce7(0xcc)]=(0x0,typeorm_1[_0x2c0ce7(0x79)])('%'+_0x2863d5+'%'));const [_0x20bdfc,_0x4cdb23]=await this[_0x2c0ce7(0x68)][_0x2c0ce7(0x9c)]({'where':_0x9498e1,'skip':(page-0x1)*size,'take':size,'order':{'id':'ASC'}});return{'rows':_0x20bdfc,'count':_0x4cdb23};}async[_0xe2f930(0x72)](_0x31a63a){const _0x7d7651=_0xe2f930,_0x3cc1ac=await this[_0x7d7651(0x68)][_0x7d7651(0x7c)]({'where':{'id':_0x31a63a['id']}});if(!_0x3cc1ac)throw new common_1[(_0x7d7651(0xa6))](_0x7d7651(0x8a),common_1[_0x7d7651(0xa7)][_0x7d7651(0xa8)]);const _0x326a41=await this[_0x7d7651(0x68)][_0x7d7651(0x6a)]({'id':_0x31a63a['id']});if(_0x326a41[_0x7d7651(0x6d)]>0x0)return await this[_0x7d7651(0x8e)](),_0x7d7651(0x7f);else throw new common_1[(_0x7d7651(0xa6))](_0x7d7651(0xb8),common_1[_0x7d7651(0xa7)][_0x7d7651(0xa8)]);}async[_0xe2f930(0x6f)](_0x19951d){const _0xd86c8a=_0xe2f930,{id:_0x4d0304,word:_0x189a7f,status:_0x3a352d}=_0x19951d,_0x48ae5c=await this['badWordsEntity']['findOne']({'where':{'word':_0x189a7f}});if(_0x48ae5c)throw new common_1[(_0xd86c8a(0xa6))](_0xd86c8a(0xc5),common_1[_0xd86c8a(0xa7)][_0xd86c8a(0xa8)]);const _0x195915=await this[_0xd86c8a(0x68)][_0xd86c8a(0x9e)]({'id':_0x4d0304},{'word':_0x189a7f,'status':_0x3a352d});if(_0x195915[_0xd86c8a(0x6d)]>0x0)return await this[_0xd86c8a(0x8e)](),_0xd86c8a(0x75);else throw new common_1[(_0xd86c8a(0xa6))](_0xd86c8a(0xd5),common_1[_0xd86c8a(0xa7)]['BAD_REQUEST']);}async[_0xe2f930(0xc4)](_0x595d95){const _0x47f78f=_0xe2f930,{word:_0x28b180}=_0x595d95,_0x2128b1=await this[_0x47f78f(0x68)][_0x47f78f(0x7c)]({'where':{'word':_0x28b180}});if(_0x2128b1)throw new common_1[(_0x47f78f(0xa6))]('敏感词已存在,请检查您的提交信息',common_1[_0x47f78f(0xa7)][_0x47f78f(0xa8)]);return await this[_0x47f78f(0x68)]['save']({'word':_0x28b180}),await this['loadBadWords'](),_0x47f78f(0x99);}async[_0xe2f930(0x67)](_0x20b053,_0x5171d7,_0x41682c,_0x4c62a1,_0x3753b5){const _0x5e8137=_0xe2f930,_0x5763a3={'userId':_0x20b053,'content':_0x5171d7,'words':JSON[_0x5e8137(0x8d)](_0x41682c),'typeCn':JSON[_0x5e8137(0x8d)](_0x4c62a1),'typeOriginCn':_0x3753b5};try{await this[_0x5e8137(0xbd)]['createQueryBuilder']()[_0x5e8137(0x9e)](user_entity_1['UserEntity'])[_0x5e8137(0x8f)]({'violationCount':()=>'violationCount\x20+\x201'})[_0x5e8137(0xc9)](_0x5e8137(0xb9),{'userId':_0x20b053})[_0x5e8137(0x78)](),await this[_0x5e8137(0xca)][_0x5e8137(0x74)](_0x5763a3);}catch(_0x1898fe){console[_0x5e8137(0x92)](_0x5e8137(0xd3),_0x1898fe);}}async[_0xe2f930(0x95)](_0x289e1c,_0x45d386){const _0x4542d8=_0xe2f930,{role:_0x127a90}=_0x289e1c[_0x4542d8(0xc1)],{page:page=0x1,size:size=0xa,userId:_0x3bce74,typeOriginCn:_0x4acbb6}=_0x45d386,_0x552595={};_0x3bce74&&(_0x552595[_0x4542d8(0xd4)]=_0x3bce74),_0x4acbb6&&(_0x552595[_0x4542d8(0x82)]=_0x4acbb6);const [_0x1e1b81,_0x2f1834]=await this['violationLogEntity']['findAndCount']({'where':_0x552595,'skip':(page-0x1)*size,'take':size,'order':{'id':_0x4542d8(0xc8)}}),_0x3e2711=[...new Set(_0x1e1b81[_0x4542d8(0x96)](_0x19bf10=>_0x19bf10['userId']))],_0x9a38fc=await this[_0x4542d8(0xbd)][_0x4542d8(0x8b)]({'where':{'id':(0x0,typeorm_1['In'])(_0x3e2711)},'select':['id',_0x4542d8(0xd1),_0x4542d8(0xd6),_0x4542d8(0x9a),_0x4542d8(0x77),_0x4542d8(0x70)]});return _0x1e1b81[_0x4542d8(0xb5)](_0xdea6bc=>{const _0x1513cc=_0x4542d8,_0x500c69=_0x9a38fc[_0x1513cc(0x8b)](_0x4c87f9=>_0x4c87f9['id']===_0xdea6bc[_0x1513cc(0xd4)]);_0x127a90!==_0x1513cc(0xab)&&(_0x500c69['email']=(0x0,utils_1['hideString'])(_0x500c69['email'])),_0xdea6bc['userInfo']=_0x500c69;}),{'rows':_0x1e1b81,'count':_0x2f1834};}};BadwordsService=__decorate([(0x0,common_1[_0xe2f930(0xb3)])(),__param(0x0,(0x0,typeorm_2['InjectRepository'])(badwords_entity_1[_0xe2f930(0x81)])),__param(0x1,(0x0,typeorm_2[_0xe2f930(0xa2)])(violationLog_entity_1['ViolationLogEntity'])),__param(0x2,(0x0,typeorm_2['InjectRepository'])(user_entity_1[_0xe2f930(0xc0)])),__metadata(_0xe2f930(0x90),[typeorm_1[_0xe2f930(0x93)],typeorm_1[_0xe2f930(0x93)],typeorm_1['Repository'],globalConfig_service_1[_0xe2f930(0xa5)]])],BadwordsService),exports[_0xe2f930(0xac)]=BadwordsService;function _0x12ba(){const _0x5b732e=['413898MZQAhO','GlobalConfigService','HttpException','HttpStatus','BAD_REQUEST','keyword','push','super','BadwordsService','1266SKSqOU','join','queryBadWords','match','object','function','Injectable','556101vHQmhC','forEach','百度云检测','formarTips','删除敏感词失败','id\x20=\x20:userId','8nDVVmg','自定义检测','敏感词检测\x20|\x20','userEntity','__param','./badwords.entity','UserEntity','user','424760SctFGD','4263561eCbhBO','addBadWord','敏感词已经存在了、请勿重复添加','../user/user.entity','getSensitiveConfig','DESC','where','violationLogEntity','baiduTextAccessToken','word','checkBadWords','@nestjs/typeorm','87CcSuTi','data','avatar','baidu','error:\x20','userId','更新敏感词失败','username','includes','百度文本检测出现错误、请查看配置信息:\x20','recordUserBadWords','badWordsEntity','extractContent','delete','您提交的内容中包含','globalConfigService','affected','post','updateBadWords','status','341823UAKaBJ','delBadWords','metadata','save','更新敏感词成功','./violationLog.entity','violationCount','execute','Like','default','customSensitiveWords','findOne','length','axios','删除敏感词成功','__decorate','BadWordsEntity','typeOriginCn','msg','@nestjs/common','baiduCheckBadWords','code','application/x-www-form-urlencoded','application/json','的信息、我们已对您账号进行标记、请合规使用!','敏感词不存在,请检查您的提交信息','find','检测失败','stringify','loadBadWords','set','design:paramtypes','__metadata','log','Repository','547356UrDbwq','violation','map','NineAi检测','defineProperty','添加敏感词成功','email','checkBadWordsByConfig','findAndCount','word_list','update','自定义','您提交的信息中包含','badWords','InjectRepository','nineai'];_0x12ba=function(){return _0x5b732e;};return _0x12ba();}