'use strict';const _0x2a2af9=_0x4bfd;(function(_0x531a2a,_0x25e284){const _0x2c34c1=_0x4bfd,_0x2859db=_0x531a2a();while(!![]){try{const _0x1966f1=-parseInt(_0x2c34c1(0x1f8))/0x1+-parseInt(_0x2c34c1(0x1ef))/0x2*(-parseInt(_0x2c34c1(0x1f0))/0x3)+parseInt(_0x2c34c1(0x1e5))/0x4*(-parseInt(_0x2c34c1(0x1e1))/0x5)+parseInt(_0x2c34c1(0x1d2))/0x6*(-parseInt(_0x2c34c1(0x1d8))/0x7)+parseInt(_0x2c34c1(0x1ce))/0x8+-parseInt(_0x2c34c1(0x1c2))/0x9*(-parseInt(_0x2c34c1(0x1cd))/0xa)+parseInt(_0x2c34c1(0x1c7))/0xb;if(_0x1966f1===_0x25e284)break;else _0x2859db['push'](_0x2859db['shift']());}catch(_0x102746){_0x2859db['push'](_0x2859db['shift']());}}}(_0x5103,0x36f1c));var __decorate=this&&this[_0x2a2af9(0x1ee)]||function(_0x47487d,_0xd6f744,_0x1b1a7f,_0x1f5d0a){const _0xe87091=_0x2a2af9;var _0x12c928=arguments[_0xe87091(0x1f2)],_0x4902de=_0x12c928<0x3?_0xd6f744:_0x1f5d0a===null?_0x1f5d0a=Object[_0xe87091(0x1d9)](_0xd6f744,_0x1b1a7f):_0x1f5d0a,_0x588084;if(typeof Reflect==='object'&&typeof Reflect[_0xe87091(0x1eb)]==='function')_0x4902de=Reflect[_0xe87091(0x1eb)](_0x47487d,_0xd6f744,_0x1b1a7f,_0x1f5d0a);else{for(var _0x423999=_0x47487d['length']-0x1;_0x423999>=0x0;_0x423999--)if(_0x588084=_0x47487d[_0x423999])_0x4902de=(_0x12c928<0x3?_0x588084(_0x4902de):_0x12c928>0x3?_0x588084(_0xd6f744,_0x1b1a7f,_0x4902de):_0x588084(_0xd6f744,_0x1b1a7f))||_0x4902de;}return _0x12c928>0x3&&_0x4902de&&Object[_0xe87091(0x1f7)](_0xd6f744,_0x1b1a7f,_0x4902de),_0x4902de;},__metadata=this&&this['__metadata']||function(_0xf0b4a7,_0x1f8c76){const _0x434859=_0x2a2af9;if(typeof Reflect===_0x434859(0x1de)&&typeof Reflect['metadata']===_0x434859(0x1ec))return Reflect['metadata'](_0xf0b4a7,_0x1f8c76);},__param=this&&this[_0x2a2af9(0x1d1)]||function(_0xe12c8b,_0xf2c1f4){return function(_0x43b22d,_0x5e8932){_0xf2c1f4(_0x43b22d,_0x5e8932,_0xe12c8b);};};Object[_0x2a2af9(0x1f7)](exports,_0x2a2af9(0x1ed),{'value':!![]}),exports[_0x2a2af9(0x1c4)]=void 0x0;function _0x4bfd(_0x3bb534,_0x96f8ea){const _0x5103db=_0x5103();return _0x4bfd=function(_0x4bfd22,_0x1372f){_0x4bfd22=_0x4bfd22-0x1c2;let _0x13dd39=_0x5103db[_0x4bfd22];return _0x13dd39;},_0x4bfd(_0x3bb534,_0x96f8ea);}const common_1=require('@nestjs/common'),bull_1=require(_0x2a2af9(0x1e4)),utils_1=require(_0x2a2af9(0x1c3)),midjourney_service_1=require('../midjourney/midjourney.service'),userBalance_service_1=require(_0x2a2af9(0x1f6)),globalConfig_service_1=require(_0x2a2af9(0x1dc));let QueueService=class QueueService{constructor(_0x2fd2da,_0x405472,_0x5a881c,_0x6bf644){const _0x1d4f7a=_0x2a2af9;this[_0x1d4f7a(0x1da)]=_0x2fd2da,this['midjourneyService']=_0x405472,this[_0x1d4f7a(0x1f4)]=_0x5a881c,this[_0x1d4f7a(0x1c8)]=_0x6bf644,this['jobIds']=[];}async[_0x2a2af9(0x1ca)](){const _0x37c044=_0x2a2af9;await this[_0x37c044(0x1da)][_0x37c044(0x1ea)](0x0,_0x37c044(0x1d0)),await this[_0x37c044(0x1f3)][_0x37c044(0x1df)]();}async[_0x2a2af9(0x1e6)](_0x1eed97,_0x3471d5){const _0xb4ffc7=_0x2a2af9,{imgUrl:_0x568f99,orderId:_0x2b97e8,action:_0x56e0a8,drawId:_0x10f890}=_0x1eed97;await this[_0xb4ffc7(0x1f3)]['checkLimit'](_0x3471d5),await this[_0xb4ffc7(0x1f4)][_0xb4ffc7(0x1f5)](_0x3471d5,_0xb4ffc7(0x1f1),_0x56e0a8===_0xb4ffc7(0x1c6)?0x1:0x4);if(_0x56e0a8===_0xb4ffc7(0x1c9)){const _0x4eeddd=''+(0x0,utils_1[_0xb4ffc7(0x1d3)])(),_0x26e74d=Object[_0xb4ffc7(0x1d6)](Object[_0xb4ffc7(0x1d6)]({},_0x1eed97),{'userId':_0x3471d5[_0xb4ffc7(0x1cc)]['id'],'randomDrawId':_0x4eeddd}),_0x290361=await this[_0xb4ffc7(0x1f3)][_0xb4ffc7(0x1d5)](_0x26e74d),_0x34acc6=await this[_0xb4ffc7(0x1c8)]['getConfigs']([_0xb4ffc7(0x1cb)])||0x30d40,_0x300fc9=await this[_0xb4ffc7(0x1da)][_0xb4ffc7(0x1e7)](_0xb4ffc7(0x1f1),{'id':_0x290361['id'],'action':_0x56e0a8,'userId':_0x3471d5[_0xb4ffc7(0x1cc)]['id']},{'delay':0x3e8,'timeout':+_0x34acc6});return this[_0xb4ffc7(0x1e2)][_0xb4ffc7(0x1e9)](_0x300fc9['id']),!![];}else{const {orderId:_0x149cf1,action:_0x2469ff,drawId:_0x4e20eb}=_0x1eed97,_0x1d8860=await this['midjourneyService']['getDrawActionDetail'](_0x2469ff,_0x4e20eb,_0x149cf1),_0x1dedbd=Object[_0xb4ffc7(0x1d6)](Object['assign'](Object[_0xb4ffc7(0x1d6)]({},_0x1eed97),{'userId':_0x3471d5['user']['id']}),_0x1d8860),_0x94101b=await this[_0xb4ffc7(0x1f3)]['addDrawQueue'](_0x1dedbd),_0x5cc5e5=await this[_0xb4ffc7(0x1c8)][_0xb4ffc7(0x1e0)]([_0xb4ffc7(0x1cb)])||0x30d40,_0x129cd7=await this[_0xb4ffc7(0x1da)]['add']('mjDraw',{'id':_0x94101b['id'],'action':_0x2469ff,'userId':_0x3471d5[_0xb4ffc7(0x1cc)]['id']},{'delay':0x3e8,'timeout':+_0x5cc5e5});this['jobIds']['push'](_0x129cd7['id']);return;}if(!_0x10f890||!_0x2b97e8)throw new common_1['HttpException']('缺少必要参数!',common_1[_0xb4ffc7(0x1d4)][_0xb4ffc7(0x1c5)]);}async[_0x2a2af9(0x1f9)](){return{'jobIds':this['jobIds']};}};function _0x5103(){const _0x47e63b=['BAD_REQUEST','UPSCALE','5705623yKJQeY','globalConfigService','IMAGINE','onApplicationBootstrap','mjTimeoutMs','user','2266520ueNcku','1278344ORPEaA','UserBalanceService','active','__param','138eUCtiq','createRandomUid','HttpStatus','addDrawQueue','assign','InjectQueue','102228MWysZx','getOwnPropertyDescriptor','mjDrawQueue','MidjourneyService','../globalConfig/globalConfig.service','MJDRAW','object','cleanQueue','getConfigs','8930uBvwHn','jobIds','design:paramtypes','@nestjs/bull','824nosPNF','addMjDrawQueue','add','GlobalConfigService','push','clean','decorate','function','__esModule','__decorate','8868WFCTUe','54yanqIC','mjDraw','length','midjourneyService','userBalanceService','validateBalance','../userBalance/userBalance.service','defineProperty','56090WOdEFg','getQueue','9fUxlgN','../../common/utils','QueueService'];_0x5103=function(){return _0x47e63b;};return _0x5103();}QueueService=__decorate([__param(0x0,(0x0,bull_1[_0x2a2af9(0x1d7)])(_0x2a2af9(0x1dd))),__metadata(_0x2a2af9(0x1e3),[Object,midjourney_service_1[_0x2a2af9(0x1db)],userBalance_service_1[_0x2a2af9(0x1cf)],globalConfig_service_1[_0x2a2af9(0x1e8)]])],QueueService),exports['QueueService']=QueueService;