Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / campaign / campaign.controller.js
index 2b10377..615f1e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf450=['CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper','push','sequelize','all','getBlackLists','addBlackLists','insert','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','IvrCampaigns','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','userProfileId','update','getHoppers','findOne','CmHopper'];(function(_0x5b550f,_0x5b75aa){var _0x2bdb60=function(_0x41f851){while(--_0x41f851){_0x5b550f['push'](_0x5b550f['shift']());}};_0x2bdb60(++_0x5b75aa);}(_0xf450,0x133));var _0x0f45=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf450[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f45('0x0'));var rimraf=require(_0x0f45('0x1'));var zipdir=require(_0x0f45('0x2'));var jsonpatch=require(_0x0f45('0x3'));var rp=require(_0x0f45('0x4'));var moment=require(_0x0f45('0x5'));var BPromise=require(_0x0f45('0x6'));var Mustache=require(_0x0f45('0x7'));var util=require(_0x0f45('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0f45('0x9'));var ejs=require(_0x0f45('0xa'));var fs=require('fs');var _=require(_0x0f45('0xb'));var squel=require(_0x0f45('0xc'));var crypto=require(_0x0f45('0xd'));var jsforce=require(_0x0f45('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f45('0xf'));var Papa=require(_0x0f45('0x10'));var Redis=require('ioredis');var authService=require(_0x0f45('0x11'));var qs=require(_0x0f45('0x12'));var as=require(_0x0f45('0x13'));var hardwareService=require(_0x0f45('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0f45('0x15'));var config=require(_0x0f45('0x16'));var licenseUtil=require(_0x0f45('0x17'));var db=require(_0x0f45('0x18'))['db'];function respondWithStatusCode(_0x234e1f,_0x53991d){_0x53991d=_0x53991d||0xcc;return function(_0x7ce1b9){if(_0x7ce1b9){return _0x234e1f[_0x0f45('0x19')](_0x53991d);}return _0x234e1f[_0x0f45('0x1a')](_0x53991d)[_0x0f45('0x1b')]();};}function respondWithResult(_0x59ea27,_0x5284f1){_0x5284f1=_0x5284f1||0xc8;return function(_0x486fd5){if(_0x486fd5){return _0x59ea27[_0x0f45('0x1a')](_0x5284f1)[_0x0f45('0x1c')](_0x486fd5);}};}function respondWithFilteredResult(_0x51a726,_0x575135){return function(_0x3720d8){if(_0x3720d8){var _0x219350=_0x3720d8[_0x0f45('0x1d')],_0x54e207=_0x575135['offset'],_0x10c602=_0x575135[_0x0f45('0x1e')]+_0x575135[_0x0f45('0x1f')],_0x6b069f;if(_0x10c602>=_0x219350){_0x10c602=_0x219350;_0x6b069f=0xc8;}else{_0x6b069f=0xce;}_0x51a726[_0x0f45('0x1a')](_0x6b069f);return _0x51a726[_0x0f45('0x20')](_0x0f45('0x21'),_0x54e207+'-'+_0x10c602+'/'+_0x219350)['json'](_0x3720d8);}return null;};}function patchUpdates(_0x2c01a2){return function(_0x133a47){try{jsonpatch[_0x0f45('0x22')](_0x133a47,_0x2c01a2,!![]);}catch(_0x5bffc8){return BPromise[_0x0f45('0x23')](_0x5bffc8);}return _0x133a47['save']();};}function saveUpdates(_0x82d2d3,_0x37b149){return function(_0x393a8a){if(_0x393a8a){return _0x393a8a['update'](_0x82d2d3)['then'](function(_0x250b2d){return _0x250b2d;});}return null;};}function removeEntity(_0x7fdbaf,_0x1ac56f){return function(_0x1e5619){if(_0x1e5619){return _0x1e5619[_0x0f45('0x24')]()[_0x0f45('0x25')](function(){var _0x44c1f2=_0x1e5619['get']({'plain':!![]});var _0x424d3f=_0x0f45('0x26');return db['UserProfileResource'][_0x0f45('0x24')]({'where':{'type':_0x424d3f,'resourceId':_0x44c1f2['id']}})['then'](function(){return _0x1e5619;});})[_0x0f45('0x25')](function(){_0x7fdbaf[_0x0f45('0x1a')](0xcc)[_0x0f45('0x1b')]();});}};}function handleEntityNotFound(_0x374732,_0x544eb5){return function(_0x4cc9ed){if(!_0x4cc9ed){_0x374732[_0x0f45('0x19')](0x194);}return _0x4cc9ed;};}function handleError(_0x3232ab,_0x25dde1){_0x25dde1=_0x25dde1||0x1f4;return function(_0x252106){logger['error'](_0x252106['stack']);if(_0x252106['name']){delete _0x252106[_0x0f45('0x27')];}_0x3232ab['status'](_0x25dde1)[_0x0f45('0x28')](_0x252106);};}exports[_0x0f45('0x29')]=function(_0x558096,_0x3872ec){var _0x10b983={},_0x32600b={},_0x269ce0={'count':0x0,'rows':[]};var _0x228c5c=_[_0x0f45('0x2a')](db['Campaign'][_0x0f45('0x2b')],function(_0x19fd18){return{'name':_0x19fd18[_0x0f45('0x2c')],'type':_0x19fd18[_0x0f45('0x2d')][_0x0f45('0x2e')]};});_0x32600b['model']=_[_0x0f45('0x2a')](_0x228c5c,_0x0f45('0x27'));_0x32600b[_0x0f45('0x2f')]=_[_0x0f45('0x30')](_0x558096['query']);_0x32600b[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x32600b[_0x0f45('0x33')],_0x32600b[_0x0f45('0x2f')]);_0x10b983[_0x0f45('0x34')]=_['intersection'](_0x32600b[_0x0f45('0x33')],qs['fields'](_0x558096[_0x0f45('0x2f')][_0x0f45('0x35')]));_0x10b983['attributes']=_0x10b983[_0x0f45('0x34')][_0x0f45('0x36')]?_0x10b983[_0x0f45('0x34')]:_0x32600b[_0x0f45('0x33')];if(!_0x558096['query'][_0x0f45('0x37')](_0x0f45('0x38'))){_0x10b983['limit']=qs['limit'](_0x558096[_0x0f45('0x2f')][_0x0f45('0x1f')]);_0x10b983['offset']=qs[_0x0f45('0x1e')](_0x558096[_0x0f45('0x2f')][_0x0f45('0x1e')]);}_0x10b983[_0x0f45('0x39')]=qs[_0x0f45('0x3a')](_0x558096['query'][_0x0f45('0x3a')]);_0x10b983[_0x0f45('0x3b')]=qs[_0x0f45('0x31')](_[_0x0f45('0x3c')](_0x558096['query'],_0x32600b[_0x0f45('0x31')]),_0x228c5c);if(_0x558096[_0x0f45('0x2f')][_0x0f45('0x3d')]){_0x10b983['where']=_[_0x0f45('0x3e')](_0x10b983[_0x0f45('0x3b')],{'$or':_['map'](_0x228c5c,function(_0x1e05ee){if(_0x1e05ee[_0x0f45('0x2d')]!==_0x0f45('0x3f')){var _0x22878e={};_0x22878e[_0x1e05ee[_0x0f45('0x27')]]={'$like':'%'+_0x558096[_0x0f45('0x2f')][_0x0f45('0x3d')]+'%'};return _0x22878e;}})});}_0x10b983=_[_0x0f45('0x3e')]({},_0x10b983,_0x558096[_0x0f45('0x40')]);var _0x16bbb4={'where':_0x10b983[_0x0f45('0x3b')]};return db[_0x0f45('0x41')]['count'](_0x16bbb4)[_0x0f45('0x25')](function(_0xb70eec){_0x269ce0[_0x0f45('0x1d')]=_0xb70eec;if(_0x558096[_0x0f45('0x2f')][_0x0f45('0x42')]){_0x10b983[_0x0f45('0x43')]=[{'all':!![]}];}return db[_0x0f45('0x41')][_0x0f45('0x44')](_0x10b983);})[_0x0f45('0x25')](function(_0x48055e){_0x269ce0[_0x0f45('0x45')]=_0x48055e;return _0x269ce0;})[_0x0f45('0x25')](respondWithFilteredResult(_0x3872ec,_0x10b983))[_0x0f45('0x46')](handleError(_0x3872ec,null));};exports[_0x0f45('0x47')]=function(_0x3d933e,_0x2cb5e7){var _0x20a647={'raw':![],'where':{'id':_0x3d933e['params']['id']}},_0x13daf2={};_0x13daf2[_0x0f45('0x33')]=_[_0x0f45('0x30')](db['Campaign']['rawAttributes']);_0x13daf2[_0x0f45('0x2f')]=_[_0x0f45('0x30')](_0x3d933e[_0x0f45('0x2f')]);_0x13daf2[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x13daf2[_0x0f45('0x33')],_0x13daf2[_0x0f45('0x2f')]);_0x20a647[_0x0f45('0x34')]=_[_0x0f45('0x32')](_0x13daf2[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x3d933e['query']['fields']));_0x20a647[_0x0f45('0x34')]=_0x20a647[_0x0f45('0x34')]['length']?_0x20a647[_0x0f45('0x34')]:_0x13daf2[_0x0f45('0x33')];if(_0x3d933e[_0x0f45('0x2f')][_0x0f45('0x42')]){_0x20a647[_0x0f45('0x43')]=[{'all':!![]}];}_0x20a647=_['merge']({},_0x20a647,_0x3d933e['options']);return db[_0x0f45('0x41')][_0x0f45('0x48')](_0x20a647)[_0x0f45('0x25')](handleEntityNotFound(_0x2cb5e7,null))['then'](respondWithResult(_0x2cb5e7,null))[_0x0f45('0x46')](handleError(_0x2cb5e7,null));};exports['create']=function(_0xdfd422,_0x5672aa){return db['Campaign'][_0x0f45('0x49')](_0xdfd422[_0x0f45('0x4a')],{})['then'](function(_0x945686){var _0x8b6d73=_0xdfd422[_0x0f45('0x4b')]['get']({'plain':!![]});if(!_0x8b6d73)throw new Error(_0x0f45('0x4c'));if(_0x8b6d73['role']===_0x0f45('0x4b')){var _0x3bed8e=_0x945686[_0x0f45('0x4d')]({'plain':!![]});var _0x3cd94a=_0x0f45('0x26');return db[_0x0f45('0x4e')][_0x0f45('0x48')]({'where':{'name':_0x3cd94a,'userProfileId':_0x8b6d73['userProfileId']},'raw':!![]})[_0x0f45('0x25')](function(_0x162f15){if(_0x162f15&&_0x162f15['autoAssociation']===0x0){return db[_0x0f45('0x4f')][_0x0f45('0x49')]({'name':_0x3bed8e[_0x0f45('0x27')],'resourceId':_0x3bed8e['id'],'type':_0x162f15['name'],'sectionId':_0x162f15['id']},{})['then'](function(){return _0x945686;});}else{return _0x945686;}})['catch'](function(_0x2072d6){logger[_0x0f45('0x50')](_0x0f45('0x51'),_0x2072d6);throw _0x2072d6;});}return _0x945686;})[_0x0f45('0x25')](respondWithResult(_0x5672aa,0xc9))[_0x0f45('0x46')](handleError(_0x5672aa,null));};exports[_0x0f45('0x52')]=function(_0x4ed60e,_0x3eee70){var _0x485a08={'where':{'id':_0x4ed60e[_0x0f45('0x53')]['id']}},_0x2a2139={};_0x2a2139[_0x0f45('0x33')]=_[_0x0f45('0x30')](db[_0x0f45('0x41')][_0x0f45('0x2b')]);_0x485a08[_0x0f45('0x34')]=_['intersection'](_0x2a2139[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x4ed60e[_0x0f45('0x2f')][_0x0f45('0x35')]));_0x485a08[_0x0f45('0x34')]=_0x485a08[_0x0f45('0x34')][_0x0f45('0x36')]?_0x485a08[_0x0f45('0x34')]:_0x2a2139[_0x0f45('0x33')];if(_0x4ed60e[_0x0f45('0x2f')][_0x0f45('0x42')]){_0x485a08[_0x0f45('0x43')]=[{'all':!![]}];}_0x485a08=_['merge']({},_0x485a08,_0x4ed60e[_0x0f45('0x40')]);return db['Campaign'][_0x0f45('0x48')](_0x485a08)[_0x0f45('0x25')](handleEntityNotFound(_0x3eee70,null))[_0x0f45('0x25')](function(_0x2eb6a7){if(_0x2eb6a7){var _0x364e26=_0x2eb6a7[_0x0f45('0x4d')]({'plain':!![]});_0x364e26=qs[_0x0f45('0x54')](_0x364e26,['id',_0x0f45('0x55'),_0x0f45('0x56')]);_0x4ed60e['body']=_[_0x0f45('0x54')](_0x4ed60e[_0x0f45('0x4a')],['id',_0x0f45('0x55'),_0x0f45('0x56')]);return db['Campaign']['create'](_[_0x0f45('0x3e')](_0x364e26,_0x4ed60e[_0x0f45('0x4a')]),{'include':_0x4ed60e[_0x0f45('0x2f')][_0x0f45('0x42')]?[{'all':!![]}]:undefined})[_0x0f45('0x25')](function(_0x42d876){var _0xa47a91=_0x4ed60e[_0x0f45('0x4b')][_0x0f45('0x4d')]({'plain':!![]});if(!_0xa47a91)throw new Error(_0x0f45('0x4c'));if(_0xa47a91['role']===_0x0f45('0x4b')){var _0x3d6a88=_0x42d876['get']({'plain':!![]});var _0x38ff31='IvrCampaigns';return db['UserProfileSection'][_0x0f45('0x48')]({'where':{'name':_0x38ff31,'userProfileId':_0xa47a91[_0x0f45('0x57')]},'raw':!![]})[_0x0f45('0x25')](function(_0x3533d1){if(_0x3533d1&&_0x3533d1['autoAssociation']===0x0){return db[_0x0f45('0x4f')][_0x0f45('0x49')]({'name':_0x3d6a88[_0x0f45('0x27')],'resourceId':_0x3d6a88['id'],'type':_0x3533d1[_0x0f45('0x27')],'sectionId':_0x3533d1['id']},{})['then'](function(){return _0x42d876;});}else{return _0x42d876;}})['catch'](function(_0x5d958a){logger[_0x0f45('0x50')](_0x0f45('0x51'),_0x5d958a);throw _0x5d958a;});}return _0x42d876;});}})[_0x0f45('0x25')](respondWithResult(_0x3eee70,0xc9))[_0x0f45('0x46')](handleError(_0x3eee70,null));};exports[_0x0f45('0x58')]=function(_0x463eb7,_0x48af0f){if(_0x463eb7[_0x0f45('0x4a')]['id']){delete _0x463eb7[_0x0f45('0x4a')]['id'];}return db[_0x0f45('0x41')][_0x0f45('0x48')]({'where':{'id':_0x463eb7[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x48af0f,null))[_0x0f45('0x25')](saveUpdates(_0x463eb7[_0x0f45('0x4a')],null))[_0x0f45('0x25')](respondWithResult(_0x48af0f,null))[_0x0f45('0x46')](handleError(_0x48af0f,null));};exports[_0x0f45('0x24')]=function(_0x7d43bc,_0x13b60a){return db[_0x0f45('0x41')][_0x0f45('0x48')]({'where':{'id':_0x7d43bc[_0x0f45('0x53')]['id']}})['then'](handleEntityNotFound(_0x13b60a,null))[_0x0f45('0x25')](removeEntity(_0x13b60a,null))[_0x0f45('0x46')](handleError(_0x13b60a,null));};exports[_0x0f45('0x59')]=function(_0x2574e3,_0x356fed,_0x470219){var _0x39cbbd={'raw':!![],'where':{}};var _0x5bdad0={};var _0x421842={'count':0x0,'rows':[]};return db[_0x0f45('0x41')][_0x0f45('0x5a')]({'where':{'id':_0x2574e3[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x356fed,null))['then'](function(_0x2460d0){if(_0x2460d0){_0x5bdad0['model']=_[_0x0f45('0x30')](db[_0x0f45('0x5b')][_0x0f45('0x2b')]);_0x5bdad0[_0x0f45('0x2f')]=_[_0x0f45('0x30')](_0x2574e3[_0x0f45('0x2f')]);_0x5bdad0['filters']=_[_0x0f45('0x32')](_0x5bdad0[_0x0f45('0x33')],_0x5bdad0[_0x0f45('0x2f')]);_0x39cbbd['attributes']=_[_0x0f45('0x32')](_0x5bdad0['model'],qs[_0x0f45('0x35')](_0x2574e3[_0x0f45('0x2f')][_0x0f45('0x35')]));_0x39cbbd[_0x0f45('0x34')]=_0x39cbbd[_0x0f45('0x34')][_0x0f45('0x36')]?_0x39cbbd[_0x0f45('0x34')]:_0x5bdad0[_0x0f45('0x33')];if(!_0x2574e3[_0x0f45('0x2f')][_0x0f45('0x37')](_0x0f45('0x38'))){_0x39cbbd[_0x0f45('0x1f')]=qs[_0x0f45('0x1f')](_0x2574e3[_0x0f45('0x2f')][_0x0f45('0x1f')]);_0x39cbbd[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x2574e3[_0x0f45('0x2f')]['offset']);}_0x39cbbd[_0x0f45('0x39')]=qs[_0x0f45('0x3a')](_0x2574e3[_0x0f45('0x2f')][_0x0f45('0x3a')]);_0x39cbbd['where']=qs[_0x0f45('0x31')](_[_0x0f45('0x3c')](_0x2574e3[_0x0f45('0x2f')],_0x5bdad0[_0x0f45('0x31')]));_0x39cbbd['where'][_0x0f45('0x5c')]=_0x2460d0['id'];if(_0x2574e3[_0x0f45('0x2f')][_0x0f45('0x3d')]){_0x39cbbd[_0x0f45('0x3b')]=_[_0x0f45('0x3e')](_0x39cbbd[_0x0f45('0x3b')],{'$or':_[_0x0f45('0x2a')](_0x39cbbd[_0x0f45('0x34')],function(_0x4493ee){var _0x401e42={};_0x401e42[_0x4493ee]={'$like':'%'+_0x2574e3['query'][_0x0f45('0x3d')]+'%'};return _0x401e42;})});}_0x39cbbd=_[_0x0f45('0x3e')]({},_0x39cbbd,_0x2574e3[_0x0f45('0x40')]);return db[_0x0f45('0x5b')][_0x0f45('0x1d')]({'where':_0x39cbbd[_0x0f45('0x3b')]})['then'](function(_0x2177fa){_0x421842[_0x0f45('0x1d')]=_0x2177fa;if(_0x2574e3[_0x0f45('0x2f')]['includeAll']){_0x39cbbd[_0x0f45('0x43')]=[{'all':!![]}];}return db[_0x0f45('0x5b')][_0x0f45('0x44')](_0x39cbbd);})[_0x0f45('0x25')](function(_0x509522){_0x421842['rows']=_0x509522;return _0x421842;});}})[_0x0f45('0x25')](respondWithFilteredResult(_0x356fed,_0x39cbbd))[_0x0f45('0x46')](handleError(_0x356fed,null));};exports['getHopperHistories']=function(_0x464c66,_0x1d3402,_0x69e961){var _0x21d420={'raw':!![],'where':{}};var _0x33cbe8={};var _0x3e3da5={'count':0x0,'rows':[]};return db[_0x0f45('0x41')]['findOne']({'where':{'id':_0x464c66[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x1d3402,null))[_0x0f45('0x25')](function(_0x553e7d){if(_0x553e7d){_0x33cbe8['model']=_[_0x0f45('0x30')](db[_0x0f45('0x5d')][_0x0f45('0x2b')]);_0x33cbe8['query']=_[_0x0f45('0x30')](_0x464c66[_0x0f45('0x2f')]);_0x33cbe8['filters']=_[_0x0f45('0x32')](_0x33cbe8[_0x0f45('0x33')],_0x33cbe8[_0x0f45('0x2f')]);_0x21d420[_0x0f45('0x34')]=_[_0x0f45('0x32')](_0x33cbe8[_0x0f45('0x33')],qs['fields'](_0x464c66[_0x0f45('0x2f')]['fields']));_0x21d420[_0x0f45('0x34')]=_0x21d420[_0x0f45('0x34')][_0x0f45('0x36')]?_0x21d420[_0x0f45('0x34')]:_0x33cbe8[_0x0f45('0x33')];if(!_0x464c66[_0x0f45('0x2f')][_0x0f45('0x37')](_0x0f45('0x38'))){_0x21d420[_0x0f45('0x1f')]=qs[_0x0f45('0x1f')](_0x464c66[_0x0f45('0x2f')]['limit']);_0x21d420[_0x0f45('0x1e')]=qs['offset'](_0x464c66['query'][_0x0f45('0x1e')]);}_0x21d420[_0x0f45('0x39')]=qs[_0x0f45('0x3a')](_0x464c66[_0x0f45('0x2f')][_0x0f45('0x3a')]);_0x21d420[_0x0f45('0x3b')]=qs[_0x0f45('0x31')](_[_0x0f45('0x3c')](_0x464c66[_0x0f45('0x2f')],_0x33cbe8[_0x0f45('0x31')]));_0x21d420[_0x0f45('0x3b')]['CampaignId']=_0x553e7d['id'];if(_0x464c66['query'][_0x0f45('0x3d')]){_0x21d420[_0x0f45('0x3b')]=_['merge'](_0x21d420[_0x0f45('0x3b')],{'$or':_[_0x0f45('0x2a')](_0x21d420['attributes'],function(_0x327e9f){var _0x315f62={};_0x315f62[_0x327e9f]={'$like':'%'+_0x464c66['query'][_0x0f45('0x3d')]+'%'};return _0x315f62;})});}_0x21d420=_[_0x0f45('0x3e')]({},_0x21d420,_0x464c66[_0x0f45('0x40')]);return db[_0x0f45('0x5d')][_0x0f45('0x1d')]({'where':_0x21d420['where']})['then'](function(_0x3ea472){_0x3e3da5[_0x0f45('0x1d')]=_0x3ea472;if(_0x464c66[_0x0f45('0x2f')][_0x0f45('0x42')]){_0x21d420['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0f45('0x44')](_0x21d420);})['then'](function(_0x343d89){_0x3e3da5[_0x0f45('0x45')]=_0x343d89;return _0x3e3da5;});}})[_0x0f45('0x25')](respondWithFilteredResult(_0x1d3402,_0x21d420))[_0x0f45('0x46')](handleError(_0x1d3402,null));};exports['getHopperFinals']=function(_0x799e5c,_0x4a340f,_0x324d9d){var _0x230ba7={'raw':!![],'where':{}};var _0xbb3ea1={};var _0x59acbc={'count':0x0,'rows':[]};return db[_0x0f45('0x41')][_0x0f45('0x5a')]({'where':{'id':_0x799e5c[_0x0f45('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a340f,null))[_0x0f45('0x25')](function(_0x2f481f){if(_0x2f481f){_0xbb3ea1[_0x0f45('0x33')]=_[_0x0f45('0x30')](db[_0x0f45('0x5e')][_0x0f45('0x2b')]);_0xbb3ea1['query']=_[_0x0f45('0x30')](_0x799e5c[_0x0f45('0x2f')]);_0xbb3ea1['filters']=_['intersection'](_0xbb3ea1['model'],_0xbb3ea1['query']);_0x230ba7['attributes']=_[_0x0f45('0x32')](_0xbb3ea1[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x799e5c['query'][_0x0f45('0x35')]));_0x230ba7['attributes']=_0x230ba7[_0x0f45('0x34')][_0x0f45('0x36')]?_0x230ba7['attributes']:_0xbb3ea1['model'];if(!_0x799e5c[_0x0f45('0x2f')][_0x0f45('0x37')]('nolimit')){_0x230ba7['limit']=qs[_0x0f45('0x1f')](_0x799e5c['query'][_0x0f45('0x1f')]);_0x230ba7[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x799e5c[_0x0f45('0x2f')][_0x0f45('0x1e')]);}_0x230ba7[_0x0f45('0x39')]=qs['sort'](_0x799e5c[_0x0f45('0x2f')][_0x0f45('0x3a')]);_0x230ba7['where']=qs[_0x0f45('0x31')](_['pick'](_0x799e5c[_0x0f45('0x2f')],_0xbb3ea1[_0x0f45('0x31')]));_0x230ba7['where'][_0x0f45('0x5c')]=_0x2f481f['id'];if(_0x799e5c['query']['filter']){_0x230ba7[_0x0f45('0x3b')]=_[_0x0f45('0x3e')](_0x230ba7['where'],{'$or':_[_0x0f45('0x2a')](_0x230ba7[_0x0f45('0x34')],function(_0x37678a){var _0x217244={};_0x217244[_0x37678a]={'$like':'%'+_0x799e5c[_0x0f45('0x2f')]['filter']+'%'};return _0x217244;})});}_0x230ba7=_['merge']({},_0x230ba7,_0x799e5c[_0x0f45('0x40')]);return db['CmHopperFinal'][_0x0f45('0x1d')]({'where':_0x230ba7[_0x0f45('0x3b')]})[_0x0f45('0x25')](function(_0xc6f574){_0x59acbc[_0x0f45('0x1d')]=_0xc6f574;if(_0x799e5c[_0x0f45('0x2f')][_0x0f45('0x42')]){_0x230ba7[_0x0f45('0x43')]=[{'all':!![]}];}return db[_0x0f45('0x5e')]['findAll'](_0x230ba7);})[_0x0f45('0x25')](function(_0x19271c){_0x59acbc[_0x0f45('0x45')]=_0x19271c;return _0x59acbc;});}})[_0x0f45('0x25')](respondWithFilteredResult(_0x4a340f,_0x230ba7))[_0x0f45('0x46')](handleError(_0x4a340f,null));};exports[_0x0f45('0x5f')]=function(_0x193af6,_0x66abfc,_0x17b043){var _0x1736e9={'raw':!![],'where':{}};var _0x1239c2={};var _0x3c9aba={'count':0x0,'rows':[]};return db['Campaign'][_0x0f45('0x5a')]({'where':{'id':_0x193af6[_0x0f45('0x53')]['id']}})['then'](handleEntityNotFound(_0x66abfc,null))[_0x0f45('0x25')](function(_0x3cb4a1){if(_0x3cb4a1){_0x1239c2['model']=_['keys'](db['CmHopperBlack'][_0x0f45('0x2b')]);_0x1239c2['query']=_[_0x0f45('0x30')](_0x193af6[_0x0f45('0x2f')]);_0x1239c2[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x1239c2[_0x0f45('0x33')],_0x1239c2['query']);_0x1736e9[_0x0f45('0x34')]=_['intersection'](_0x1239c2[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x193af6[_0x0f45('0x2f')]['fields']));_0x1736e9[_0x0f45('0x34')]=_0x1736e9[_0x0f45('0x34')][_0x0f45('0x36')]?_0x1736e9[_0x0f45('0x34')]:_0x1239c2[_0x0f45('0x33')];if(!_0x193af6[_0x0f45('0x2f')][_0x0f45('0x37')](_0x0f45('0x38'))){_0x1736e9[_0x0f45('0x1f')]=qs[_0x0f45('0x1f')](_0x193af6[_0x0f45('0x2f')][_0x0f45('0x1f')]);_0x1736e9[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x193af6[_0x0f45('0x2f')][_0x0f45('0x1e')]);}_0x1736e9[_0x0f45('0x39')]=qs[_0x0f45('0x3a')](_0x193af6[_0x0f45('0x2f')][_0x0f45('0x3a')]);_0x1736e9[_0x0f45('0x3b')]=qs[_0x0f45('0x31')](_['pick'](_0x193af6['query'],_0x1239c2['filters']));_0x1736e9[_0x0f45('0x3b')]['CampaignId']=_0x3cb4a1['id'];if(_0x193af6[_0x0f45('0x2f')][_0x0f45('0x3d')]){_0x1736e9[_0x0f45('0x3b')]=_['merge'](_0x1736e9['where'],{'$or':_[_0x0f45('0x2a')](_0x1736e9[_0x0f45('0x34')],function(_0x347b63){var _0x22eeb3={};_0x22eeb3[_0x347b63]={'$like':'%'+_0x193af6[_0x0f45('0x2f')][_0x0f45('0x3d')]+'%'};return _0x22eeb3;})});}_0x1736e9=_[_0x0f45('0x3e')]({},_0x1736e9,_0x193af6[_0x0f45('0x40')]);return db[_0x0f45('0x60')]['count']({'where':_0x1736e9['where']})[_0x0f45('0x25')](function(_0x1ab2d9){_0x3c9aba[_0x0f45('0x1d')]=_0x1ab2d9;if(_0x193af6['query'][_0x0f45('0x42')]){_0x1736e9[_0x0f45('0x43')]=[{'all':!![]}];}return db[_0x0f45('0x60')][_0x0f45('0x44')](_0x1736e9);})[_0x0f45('0x25')](function(_0x556c9e){_0x3c9aba[_0x0f45('0x45')]=_0x556c9e;return _0x3c9aba;});}})[_0x0f45('0x25')](respondWithFilteredResult(_0x66abfc,_0x1736e9))[_0x0f45('0x46')](handleError(_0x66abfc,null));};exports[_0x0f45('0x61')]=function(_0x3f60ae,_0x12c566,_0x40e60e){var _0x541c94={};var _0x458a32={};var _0x11b659;var _0x3b07a8;return db[_0x0f45('0x41')]['findOne']({'where':{'id':_0x3f60ae[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x12c566,null))[_0x0f45('0x25')](function(_0x4886fb){if(_0x4886fb){_0x11b659=_0x4886fb;_0x458a32[_0x0f45('0x33')]=_[_0x0f45('0x30')](db[_0x0f45('0x62')][_0x0f45('0x2b')]);_0x458a32[_0x0f45('0x2f')]=_['keys'](_0x3f60ae[_0x0f45('0x2f')]);_0x458a32['filters']=_['intersection'](_0x458a32[_0x0f45('0x33')],_0x458a32[_0x0f45('0x2f')]);_0x541c94['attributes']=_[_0x0f45('0x32')](_0x458a32[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x3f60ae[_0x0f45('0x2f')][_0x0f45('0x35')]));_0x541c94[_0x0f45('0x34')]=_0x541c94['attributes'][_0x0f45('0x36')]?_0x541c94['attributes']:_0x458a32['model'];_0x541c94['order']=qs[_0x0f45('0x3a')](_0x3f60ae['query']['sort']);_0x541c94[_0x0f45('0x3b')]=qs['filters'](_[_0x0f45('0x3c')](_0x3f60ae[_0x0f45('0x2f')],_0x458a32[_0x0f45('0x31')]));if(_0x3f60ae[_0x0f45('0x2f')][_0x0f45('0x3d')]){_0x541c94[_0x0f45('0x3b')]=_[_0x0f45('0x3e')](_0x541c94[_0x0f45('0x3b')],{'$or':_[_0x0f45('0x2a')](_0x541c94[_0x0f45('0x34')],function(_0x493903){var _0x2214f2={};_0x2214f2[_0x493903]={'$like':'%'+_0x3f60ae[_0x0f45('0x2f')]['filter']+'%'};return _0x2214f2;})});}_0x541c94=_[_0x0f45('0x3e')]({},_0x541c94,_0x3f60ae['options']);return _0x11b659[_0x0f45('0x61')](_0x541c94);}})['then'](function(_0x56b399){if(_0x56b399){_0x3b07a8=_0x56b399[_0x0f45('0x36')];if(!_0x3f60ae[_0x0f45('0x2f')][_0x0f45('0x37')]('nolimit')){_0x541c94[_0x0f45('0x1f')]=qs[_0x0f45('0x1f')](_0x3f60ae['query'][_0x0f45('0x1f')]);_0x541c94[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x3f60ae[_0x0f45('0x2f')][_0x0f45('0x1e')]);}return _0x11b659[_0x0f45('0x61')](_0x541c94);}})[_0x0f45('0x25')](function(_0x2ea951){if(_0x2ea951){return _0x2ea951?{'count':_0x3b07a8,'rows':_0x2ea951}:null;}})[_0x0f45('0x25')](respondWithResult(_0x12c566,null))[_0x0f45('0x46')](handleError(_0x12c566,null));};exports[_0x0f45('0x63')]=function(_0x140aaa,_0x289443,_0x429b6a){var _0x27b25a,_0x24ef83;return db['Campaign'][_0x0f45('0x48')]({'where':{'id':_0x140aaa['params']['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x289443,null))[_0x0f45('0x25')](function(_0x2eac78){if(_0x2eac78){_0x24ef83=_0x2eac78;return _0x2eac78[_0x0f45('0x63')](_0x140aaa['body'][_0x0f45('0x64')],_[_0x0f45('0x54')](_0x140aaa[_0x0f45('0x4a')],[_0x0f45('0x64'),'id'])||{});}return null;})[_0x0f45('0x65')](function(_0x7d51de){var _0x5e802c;_0x27b25a=_0x7d51de||[];var _0x155685=[];if(_0x7d51de){for(var _0x1c20c0=0x0;_0x1c20c0<_0x7d51de[_0x0f45('0x36')];_0x1c20c0+=0x1){var _0x10047b=_0x7d51de[_0x1c20c0][_0x0f45('0x4d')]({'plain':!![]});_0x24ef83[_0x0f45('0x66')]=_0x140aaa[_0x0f45('0x4a')]['dialCheckDuplicateType']?_0x140aaa[_0x0f45('0x4a')][_0x0f45('0x66')]:_0x24ef83[_0x0f45('0x66')];switch(_0x24ef83[_0x0f45('0x66')]){case _0x0f45('0x67'):_0x5e802c=squel['insert']()[_0x0f45('0x68')]('cm_hopper')['fromQuery']([_0x0f45('0x69'),_0x0f45('0x6a'),_0x0f45('0x6b'),_0x0f45('0x6c'),_0x0f45('0x5c'),'createdAt',_0x0f45('0x56')],squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')](_0x0f45('0x69'),_0x0f45('0x69'))['field']('NOW()',_0x0f45('0x6a'))[_0x0f45('0x6e')]('id','ContactId')[_0x0f45('0x6e')](_0x10047b[_0x0f45('0x6f')]['toString'](),_0x0f45('0x6c'))['field'](_0x140aaa[_0x0f45('0x53')]['id'][_0x0f45('0x70')](),'CampaignId')['field'](_0x0f45('0x71'),_0x0f45('0x55'))['field']('NOW()',_0x0f45('0x56'))[_0x0f45('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x0f45('0x3b')](_0x0f45('0x73'),_0x10047b['CmListId'][_0x0f45('0x70')]())[_0x0f45('0x3b')](_0x0f45('0x74'))[_0x0f45('0x3b')](_0x0f45('0x75'),squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0x0f45('0x72')](_0x0f45('0x76'))[_0x0f45('0x3b')](_0x0f45('0x77'),_0x140aaa[_0x0f45('0x53')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')](_0x0f45('0x78'))[_0x0f45('0x72')]('cm_hopper')[_0x0f45('0x3b')]('CampaignId\x20=\x20?',_0x140aaa['params']['id'][_0x0f45('0x70')]())))[_0x0f45('0x70')]();break;case'onlyIfOpen':_0x5e802c=squel['insert']()[_0x0f45('0x68')]('cm_hopper')[_0x0f45('0x79')](['phone',_0x0f45('0x6a'),_0x0f45('0x6b'),_0x0f45('0x6c'),_0x0f45('0x5c'),_0x0f45('0x55'),'updatedAt'],squel['select']()[_0x0f45('0x6e')](_0x0f45('0x69'),_0x0f45('0x69'))[_0x0f45('0x6e')](_0x0f45('0x71'),_0x0f45('0x6a'))[_0x0f45('0x6e')]('id',_0x0f45('0x6b'))[_0x0f45('0x6e')](_0x10047b[_0x0f45('0x6f')]['toString'](),_0x0f45('0x6c'))[_0x0f45('0x6e')](_0x140aaa['params']['id']['toString'](),_0x0f45('0x5c'))[_0x0f45('0x6e')](_0x0f45('0x71'),_0x0f45('0x55'))[_0x0f45('0x6e')](_0x0f45('0x71'),_0x0f45('0x56'))[_0x0f45('0x72')](_0x0f45('0x7a'))[_0x0f45('0x3b')](_0x0f45('0x7b'))['where']('ListId\x20=\x20?',_0x10047b[_0x0f45('0x6f')][_0x0f45('0x70')]())[_0x0f45('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')](_0x0f45('0x78'))['from'](_0x0f45('0x7c'))[_0x0f45('0x3b')](_0x0f45('0x77'),_0x140aaa[_0x0f45('0x53')]['id']['toString']())))[_0x0f45('0x70')]();break;default:_0x5e802c=squel['insert']()[_0x0f45('0x68')](_0x0f45('0x7c'))[_0x0f45('0x79')]([_0x0f45('0x69'),_0x0f45('0x6a'),_0x0f45('0x6b'),_0x0f45('0x6c'),_0x0f45('0x5c'),'createdAt',_0x0f45('0x56')],squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')](_0x0f45('0x69'),_0x0f45('0x69'))[_0x0f45('0x6e')]('NOW()',_0x0f45('0x6a'))[_0x0f45('0x6e')]('id',_0x0f45('0x6b'))[_0x0f45('0x6e')](_0x10047b['CmListId'][_0x0f45('0x70')](),'ListId')[_0x0f45('0x6e')](_0x140aaa[_0x0f45('0x53')]['id'][_0x0f45('0x70')](),_0x0f45('0x5c'))[_0x0f45('0x6e')](_0x0f45('0x71'),'createdAt')[_0x0f45('0x6e')](_0x0f45('0x71'),_0x0f45('0x56'))[_0x0f45('0x72')](_0x0f45('0x7a'))[_0x0f45('0x3b')](_0x0f45('0x7b'))[_0x0f45('0x3b')](_0x0f45('0x73'),_0x10047b[_0x0f45('0x6f')][_0x0f45('0x70')]())[_0x0f45('0x3b')](_0x0f45('0x74')))[_0x0f45('0x70')]();}_0x155685[_0x0f45('0x7d')](db[_0x0f45('0x7e')][_0x0f45('0x2f')](_0x5e802c));}return BPromise[_0x0f45('0x7f')](_0x155685);}})[_0x0f45('0x25')](function(){return _0x27b25a;})[_0x0f45('0x25')](respondWithResult(_0x289443,null))[_0x0f45('0x46')](handleError(_0x289443,null));};exports['removeLists']=function(_0x27e38e,_0x268e81,_0x56ac84){return db[_0x0f45('0x41')][_0x0f45('0x48')]({'where':{'id':_0x27e38e[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x268e81,null))['then'](function(_0x542c00){if(_0x542c00){return _0x542c00['removeLists'](_0x27e38e[_0x0f45('0x2f')][_0x0f45('0x64')]);}})['then'](function(_0xe070c9){if(_0xe070c9){return db['CmHopper'][_0x0f45('0x24')]({'where':{'ListId':_0x27e38e['query'][_0x0f45('0x64')],'CampaignId':_0x27e38e['params']['id']}})[_0x0f45('0x25')](function(){return _0xe070c9;});}})[_0x0f45('0x25')](respondWithStatusCode(_0x268e81,null))[_0x0f45('0x46')](handleError(_0x268e81,null));};exports['getBlackLists']=function(_0x38e7fc,_0x239063,_0x4873ff){var _0x509348={};var _0x321ea5={};var _0x2b8a6b;var _0x107369;return db['Campaign'][_0x0f45('0x5a')]({'where':{'id':_0x38e7fc[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x239063,null))[_0x0f45('0x25')](function(_0x59bb91){if(_0x59bb91){_0x2b8a6b=_0x59bb91;_0x321ea5['model']=_[_0x0f45('0x30')](db[_0x0f45('0x62')]['rawAttributes']);_0x321ea5[_0x0f45('0x2f')]=_[_0x0f45('0x30')](_0x38e7fc[_0x0f45('0x2f')]);_0x321ea5[_0x0f45('0x31')]=_['intersection'](_0x321ea5[_0x0f45('0x33')],_0x321ea5[_0x0f45('0x2f')]);_0x509348[_0x0f45('0x34')]=_['intersection'](_0x321ea5[_0x0f45('0x33')],qs[_0x0f45('0x35')](_0x38e7fc[_0x0f45('0x2f')]['fields']));_0x509348[_0x0f45('0x34')]=_0x509348[_0x0f45('0x34')][_0x0f45('0x36')]?_0x509348[_0x0f45('0x34')]:_0x321ea5['model'];_0x509348[_0x0f45('0x39')]=qs[_0x0f45('0x3a')](_0x38e7fc['query'][_0x0f45('0x3a')]);_0x509348['where']=qs['filters'](_['pick'](_0x38e7fc[_0x0f45('0x2f')],_0x321ea5[_0x0f45('0x31')]));if(_0x38e7fc[_0x0f45('0x2f')][_0x0f45('0x3d')]){_0x509348[_0x0f45('0x3b')]=_['merge'](_0x509348[_0x0f45('0x3b')],{'$or':_[_0x0f45('0x2a')](_0x509348[_0x0f45('0x34')],function(_0x9eefca){var _0xa1a18c={};_0xa1a18c[_0x9eefca]={'$like':'%'+_0x38e7fc[_0x0f45('0x2f')][_0x0f45('0x3d')]+'%'};return _0xa1a18c;})});}_0x509348=_[_0x0f45('0x3e')]({},_0x509348,_0x38e7fc['options']);return _0x2b8a6b[_0x0f45('0x80')](_0x509348);}})[_0x0f45('0x25')](function(_0x28fee8){if(_0x28fee8){_0x107369=_0x28fee8['length'];if(!_0x38e7fc[_0x0f45('0x2f')][_0x0f45('0x37')]('nolimit')){_0x509348[_0x0f45('0x1f')]=qs[_0x0f45('0x1f')](_0x38e7fc[_0x0f45('0x2f')][_0x0f45('0x1f')]);_0x509348['offset']=qs[_0x0f45('0x1e')](_0x38e7fc[_0x0f45('0x2f')]['offset']);}return _0x2b8a6b['getBlackLists'](_0x509348);}})['then'](function(_0x57f7e3){if(_0x57f7e3){return _0x57f7e3?{'count':_0x107369,'rows':_0x57f7e3}:null;}})[_0x0f45('0x25')](respondWithResult(_0x239063,null))[_0x0f45('0x46')](handleError(_0x239063,null));};exports[_0x0f45('0x81')]=function(_0xd25eb7,_0x19db27,_0x4f4517){var _0x59e331,_0x227a8d;return db['Campaign'][_0x0f45('0x48')]({'where':{'id':_0xd25eb7[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x19db27,null))[_0x0f45('0x25')](function(_0x37a4f5){if(_0x37a4f5){_0x227a8d=_0x37a4f5;return _0x37a4f5[_0x0f45('0x81')](_0xd25eb7['body'][_0x0f45('0x64')],_[_0x0f45('0x54')](_0xd25eb7[_0x0f45('0x4a')],[_0x0f45('0x64'),'id'])||{});}return null;})[_0x0f45('0x65')](function(_0x16f015){var _0x7efc2;_0x59e331=_0x16f015||[];var _0x3a9598=[];if(_0x16f015){for(var _0x19880c=0x0;_0x19880c<_0x16f015[_0x0f45('0x36')];_0x19880c+=0x1){var _0x37e9fa=_0x16f015[_0x19880c]['get']({'plain':!![]});_0x7efc2=squel[_0x0f45('0x82')]()[_0x0f45('0x68')](_0x0f45('0x83'))[_0x0f45('0x79')](['phone',_0x0f45('0x6b'),_0x0f45('0x6c'),_0x0f45('0x5c'),_0x0f45('0x55'),_0x0f45('0x56')],squel[_0x0f45('0x6d')]()[_0x0f45('0x6e')](_0x0f45('0x69'),_0x0f45('0x69'))[_0x0f45('0x6e')]('id','ContactId')['field'](_0x37e9fa['CmListId'][_0x0f45('0x70')](),_0x0f45('0x6c'))[_0x0f45('0x6e')](_0xd25eb7['params']['id'][_0x0f45('0x70')](),_0x0f45('0x5c'))[_0x0f45('0x6e')]('NOW()',_0x0f45('0x55'))[_0x0f45('0x6e')](_0x0f45('0x71'),'updatedAt')[_0x0f45('0x72')](_0x0f45('0x7a'))[_0x0f45('0x3b')](_0x0f45('0x7b'))[_0x0f45('0x3b')](_0x0f45('0x73'),_0x37e9fa[_0x0f45('0x6f')][_0x0f45('0x70')]())[_0x0f45('0x3b')](_0x0f45('0x74')))['toString']();_0x3a9598[_0x0f45('0x7d')](db[_0x0f45('0x7e')]['query'](_0x7efc2));}return BPromise[_0x0f45('0x7f')](_0x3a9598);}})[_0x0f45('0x25')](function(){return _0x59e331;})['then'](respondWithResult(_0x19db27,null))[_0x0f45('0x46')](handleError(_0x19db27,null));};exports[_0x0f45('0x84')]=function(_0x1370d5,_0x1f0bf5,_0x556702){return db[_0x0f45('0x41')][_0x0f45('0x48')]({'where':{'id':_0x1370d5[_0x0f45('0x53')]['id']}})[_0x0f45('0x25')](handleEntityNotFound(_0x1f0bf5,null))[_0x0f45('0x25')](function(_0x169c6b){if(_0x169c6b){return _0x169c6b[_0x0f45('0x84')](_0x1370d5[_0x0f45('0x2f')][_0x0f45('0x64')]);}})[_0x0f45('0x25')](function(_0x28d299){if(_0x28d299){return db['CmHopperBlack'][_0x0f45('0x24')]({'where':{'ListId':_0x1370d5[_0x0f45('0x2f')][_0x0f45('0x64')],'CampaignId':_0x1370d5['params']['id']}})[_0x0f45('0x25')](function(){return _0x28d299;});}})['then'](respondWithStatusCode(_0x1f0bf5,null))[_0x0f45('0x46')](handleError(_0x1f0bf5,null));};
\ No newline at end of file
+var _0xf150=['undefined','limit','count','set','Content-Range','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','autoAssociation','update','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x15f5e4,_0x5b6b4c){var _0x4830e5=function(_0x112a4d){while(--_0x112a4d){_0x15f5e4['push'](_0x15f5e4['shift']());}};_0x4830e5(++_0x5b6b4c);}(_0xf150,0x106));var _0x0f15=function(_0x4865d8,_0x898ff5){_0x4865d8=_0x4865d8-0x0;var _0x134ccf=_0xf150[_0x4865d8];return _0x134ccf;};'use strict';var emlformat=require(_0x0f15('0x0'));var rimraf=require(_0x0f15('0x1'));var zipdir=require(_0x0f15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f15('0x3'));var moment=require(_0x0f15('0x4'));var BPromise=require(_0x0f15('0x5'));var Mustache=require(_0x0f15('0x6'));var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require(_0x0f15('0x9'));var csv=require(_0x0f15('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f15('0xb'));var squel=require(_0x0f15('0xc'));var crypto=require(_0x0f15('0xd'));var jsforce=require(_0x0f15('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f15('0xa'));var querystring=require('querystring');var Papa=require(_0x0f15('0xf'));var Redis=require(_0x0f15('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f15('0x11'));var hardwareService=require(_0x0f15('0x12'));var logger=require(_0x0f15('0x13'))('api');var utils=require(_0x0f15('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f15('0x15'))['db'];function respondWithStatusCode(_0x2d9cc1,_0x3146d2){_0x3146d2=_0x3146d2||0xcc;return function(_0x446cce){if(_0x446cce){return _0x2d9cc1['sendStatus'](_0x3146d2);}return _0x2d9cc1[_0x0f15('0x16')](_0x3146d2)[_0x0f15('0x17')]();};}function respondWithResult(_0x47060d,_0x4a54ea){_0x4a54ea=_0x4a54ea||0xc8;return function(_0x5ab21b){if(_0x5ab21b){return _0x47060d['status'](_0x4a54ea)[_0x0f15('0x18')](_0x5ab21b);}};}function respondWithFilteredResult(_0x33b604,_0x48138c){return function(_0x5827a9){if(_0x5827a9){var _0x46d54b=typeof _0x48138c[_0x0f15('0x19')]===_0x0f15('0x1a')&&typeof _0x48138c[_0x0f15('0x1b')]===_0x0f15('0x1a');var _0x1657e2=_0x5827a9[_0x0f15('0x1c')];var _0x47fb13=_0x46d54b?0x0:_0x48138c[_0x0f15('0x19')];var _0xae2a06=_0x46d54b?_0x5827a9['count']:_0x48138c[_0x0f15('0x19')]+_0x48138c['limit'];var _0x40e739;if(_0xae2a06>=_0x1657e2){_0xae2a06=_0x1657e2;_0x40e739=0xc8;}else{_0x40e739=0xce;}_0x33b604['status'](_0x40e739);return _0x33b604[_0x0f15('0x1d')](_0x0f15('0x1e'),_0x47fb13+'-'+_0xae2a06+'/'+_0x1657e2)['json'](_0x5827a9);}return null;};}function patchUpdates(_0x45b7ed){return function(_0x2b10fd){try{jsonpatch['apply'](_0x2b10fd,_0x45b7ed,!![]);}catch(_0x179c70){return BPromise['reject'](_0x179c70);}return _0x2b10fd['save']();};}function saveUpdates(_0x8e5c1,_0x5d5adf){return function(_0x55a9d8){if(_0x55a9d8){return _0x55a9d8['update'](_0x8e5c1)[_0x0f15('0x1f')](function(_0x179c15){return _0x179c15;});}return null;};}function removeEntity(_0x349de2,_0x2ace21){return function(_0x159ba6){if(_0x159ba6){return _0x159ba6[_0x0f15('0x20')]()[_0x0f15('0x1f')](function(){var _0x26008e=_0x159ba6[_0x0f15('0x21')]({'plain':!![]});var _0x5c9187=_0x0f15('0x22');return db[_0x0f15('0x23')][_0x0f15('0x20')]({'where':{'type':_0x5c9187,'resourceId':_0x26008e['id']}})['then'](function(){return _0x159ba6;});})[_0x0f15('0x1f')](function(){_0x349de2[_0x0f15('0x16')](0xcc)[_0x0f15('0x17')]();});}};}function handleEntityNotFound(_0x23b58e,_0x262a11){return function(_0x455139){if(!_0x455139){_0x23b58e[_0x0f15('0x24')](0x194);}return _0x455139;};}function handleError(_0x1940dd,_0xdc54c3){_0xdc54c3=_0xdc54c3||0x1f4;return function(_0xcc9776){logger[_0x0f15('0x25')](_0xcc9776['stack']);if(_0xcc9776[_0x0f15('0x26')]){delete _0xcc9776[_0x0f15('0x26')];}_0x1940dd[_0x0f15('0x16')](_0xdc54c3)[_0x0f15('0x27')](_0xcc9776);};}exports[_0x0f15('0x28')]=function(_0x38759a,_0x552c80){var _0xa3177c={},_0x57ea7c={},_0x12fea1={'count':0x0,'rows':[]};var _0x32a284=_[_0x0f15('0x29')](db[_0x0f15('0x2a')]['rawAttributes'],function(_0x56d7ff){return{'name':_0x56d7ff['fieldName'],'type':_0x56d7ff[_0x0f15('0x2b')][_0x0f15('0x2c')]};});_0x57ea7c['model']=_[_0x0f15('0x29')](_0x32a284,_0x0f15('0x26'));_0x57ea7c[_0x0f15('0x2d')]=_['keys'](_0x38759a[_0x0f15('0x2d')]);_0x57ea7c[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x57ea7c[_0x0f15('0x30')],_0x57ea7c['query']);_0xa3177c['attributes']=_[_0x0f15('0x2f')](_0x57ea7c[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x38759a[_0x0f15('0x2d')][_0x0f15('0x31')]));_0xa3177c[_0x0f15('0x32')]=_0xa3177c[_0x0f15('0x32')][_0x0f15('0x33')]?_0xa3177c[_0x0f15('0x32')]:_0x57ea7c[_0x0f15('0x30')];if(!_0x38759a[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0xa3177c['limit']=qs[_0x0f15('0x1b')](_0x38759a['query']['limit']);_0xa3177c[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x38759a['query'][_0x0f15('0x19')]);}_0xa3177c['order']=qs['sort'](_0x38759a['query'][_0x0f15('0x36')]);_0xa3177c[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x38759a[_0x0f15('0x2d')],_0x57ea7c[_0x0f15('0x2e')]),_0x32a284);if(_0x38759a['query'][_0x0f15('0x39')]){_0xa3177c[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0xa3177c[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x32a284,function(_0x4e21f4){if(_0x4e21f4[_0x0f15('0x2b')]!==_0x0f15('0x3b')){var _0x3fe0c0={};_0x3fe0c0[_0x4e21f4[_0x0f15('0x26')]]={'$like':'%'+_0x38759a['query']['filter']+'%'};return _0x3fe0c0;}})});}_0xa3177c=_[_0x0f15('0x3a')]({},_0xa3177c,_0x38759a[_0x0f15('0x3c')]);var _0x12ba44={'where':_0xa3177c['where']};return db[_0x0f15('0x2a')][_0x0f15('0x1c')](_0x12ba44)[_0x0f15('0x1f')](function(_0x15cc38){_0x12fea1['count']=_0x15cc38;if(_0x38759a[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0xa3177c[_0x0f15('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x0f15('0x3f')](_0xa3177c);})[_0x0f15('0x1f')](function(_0x1f80a4){_0x12fea1[_0x0f15('0x40')]=_0x1f80a4;return _0x12fea1;})[_0x0f15('0x1f')](respondWithFilteredResult(_0x552c80,_0xa3177c))[_0x0f15('0x41')](handleError(_0x552c80,null));};exports[_0x0f15('0x42')]=function(_0x203255,_0x3348c2){var _0x3cdf3={'raw':![],'where':{'id':_0x203255[_0x0f15('0x43')]['id']}},_0x5ae190={};_0x5ae190[_0x0f15('0x30')]=_['keys'](db[_0x0f15('0x2a')][_0x0f15('0x44')]);_0x5ae190['query']=_['keys'](_0x203255[_0x0f15('0x2d')]);_0x5ae190[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x5ae190['model'],_0x5ae190['query']);_0x3cdf3[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x5ae190[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x203255[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x3cdf3[_0x0f15('0x32')]=_0x3cdf3['attributes'][_0x0f15('0x33')]?_0x3cdf3[_0x0f15('0x32')]:_0x5ae190[_0x0f15('0x30')];if(_0x203255['query']['includeAll']){_0x3cdf3[_0x0f15('0x3e')]=[{'all':!![]}];}_0x3cdf3=_['merge']({},_0x3cdf3,_0x203255[_0x0f15('0x3c')]);return db['Campaign'][_0x0f15('0x45')](_0x3cdf3)[_0x0f15('0x1f')](handleEntityNotFound(_0x3348c2,null))[_0x0f15('0x1f')](respondWithResult(_0x3348c2,null))[_0x0f15('0x41')](handleError(_0x3348c2,null));};exports[_0x0f15('0x46')]=function(_0x40e051,_0x5ec882){return db[_0x0f15('0x2a')][_0x0f15('0x46')](_0x40e051[_0x0f15('0x47')],{})['then'](function(_0x4de6d9){var _0x505882=_0x40e051[_0x0f15('0x48')][_0x0f15('0x21')]({'plain':!![]});if(!_0x505882)throw new Error(_0x0f15('0x49'));if(_0x505882[_0x0f15('0x4a')]===_0x0f15('0x48')){var _0x21a6a7=_0x4de6d9[_0x0f15('0x21')]({'plain':!![]});var _0x406eda='IvrCampaigns';return db[_0x0f15('0x4b')]['find']({'where':{'name':_0x406eda,'userProfileId':_0x505882[_0x0f15('0x4c')]},'raw':!![]})[_0x0f15('0x1f')](function(_0x1301b2){if(_0x1301b2&&_0x1301b2['autoAssociation']===0x0){return db['UserProfileResource'][_0x0f15('0x46')]({'name':_0x21a6a7[_0x0f15('0x26')],'resourceId':_0x21a6a7['id'],'type':_0x1301b2[_0x0f15('0x26')],'sectionId':_0x1301b2['id']},{})[_0x0f15('0x1f')](function(){return _0x4de6d9;});}else{return _0x4de6d9;}})['catch'](function(_0x5156d0){logger[_0x0f15('0x25')](_0x0f15('0x4d'),_0x5156d0);throw _0x5156d0;});}return _0x4de6d9;})[_0x0f15('0x1f')](respondWithResult(_0x5ec882,0xc9))[_0x0f15('0x41')](handleError(_0x5ec882,null));};exports[_0x0f15('0x4e')]=function(_0x1a1a39,_0x3d4eb0){var _0x354719={'where':{'id':_0x1a1a39[_0x0f15('0x43')]['id']}},_0x362d9b={};_0x362d9b['model']=_[_0x0f15('0x4f')](db['Campaign'][_0x0f15('0x44')]);_0x354719['attributes']=_[_0x0f15('0x2f')](_0x362d9b['model'],qs[_0x0f15('0x31')](_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x354719[_0x0f15('0x32')]=_0x354719[_0x0f15('0x32')][_0x0f15('0x33')]?_0x354719[_0x0f15('0x32')]:_0x362d9b[_0x0f15('0x30')];if(_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x354719[_0x0f15('0x3e')]=[{'all':!![]}];}_0x354719=_[_0x0f15('0x3a')]({},_0x354719,_0x1a1a39[_0x0f15('0x3c')]);return db[_0x0f15('0x2a')]['find'](_0x354719)['then'](handleEntityNotFound(_0x3d4eb0,null))[_0x0f15('0x1f')](function(_0x5f7b10){if(_0x5f7b10){var _0x509b42=_0x5f7b10[_0x0f15('0x21')]({'plain':!![]});_0x509b42=qs[_0x0f15('0x50')](_0x509b42,['id',_0x0f15('0x51'),_0x0f15('0x52')]);_0x1a1a39[_0x0f15('0x47')]=_[_0x0f15('0x50')](_0x1a1a39[_0x0f15('0x47')],['id',_0x0f15('0x51'),_0x0f15('0x52')]);return db[_0x0f15('0x2a')][_0x0f15('0x46')](_['merge'](_0x509b42,_0x1a1a39[_0x0f15('0x47')]),{'include':_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x3d')]?[{'all':!![]}]:undefined})[_0x0f15('0x1f')](function(_0x425a9c){var _0x272977=_0x1a1a39[_0x0f15('0x48')][_0x0f15('0x21')]({'plain':!![]});if(!_0x272977)throw new Error(_0x0f15('0x49'));if(_0x272977['role']==='user'){var _0x48eb5a=_0x425a9c['get']({'plain':!![]});var _0x54dfd8='IvrCampaigns';return db[_0x0f15('0x4b')][_0x0f15('0x45')]({'where':{'name':_0x54dfd8,'userProfileId':_0x272977[_0x0f15('0x4c')]},'raw':!![]})[_0x0f15('0x1f')](function(_0x26341a){if(_0x26341a&&_0x26341a[_0x0f15('0x53')]===0x0){return db[_0x0f15('0x23')][_0x0f15('0x46')]({'name':_0x48eb5a['name'],'resourceId':_0x48eb5a['id'],'type':_0x26341a[_0x0f15('0x26')],'sectionId':_0x26341a['id']},{})[_0x0f15('0x1f')](function(){return _0x425a9c;});}else{return _0x425a9c;}})[_0x0f15('0x41')](function(_0x3c8960){logger[_0x0f15('0x25')](_0x0f15('0x4d'),_0x3c8960);throw _0x3c8960;});}return _0x425a9c;});}})[_0x0f15('0x1f')](respondWithResult(_0x3d4eb0,0xc9))[_0x0f15('0x41')](handleError(_0x3d4eb0,null));};exports[_0x0f15('0x54')]=function(_0x5374d0,_0x113531){if(_0x5374d0['body']['id']){delete _0x5374d0[_0x0f15('0x47')]['id'];}return db[_0x0f15('0x2a')]['find']({'where':{'id':_0x5374d0[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x113531,null))[_0x0f15('0x1f')](saveUpdates(_0x5374d0[_0x0f15('0x47')],null))['then'](respondWithResult(_0x113531,null))['catch'](handleError(_0x113531,null));};exports[_0x0f15('0x20')]=function(_0x2395c6,_0x1ded63){return db['Campaign'][_0x0f15('0x45')]({'where':{'id':_0x2395c6[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x1ded63,null))[_0x0f15('0x1f')](removeEntity(_0x1ded63,null))[_0x0f15('0x41')](handleError(_0x1ded63,null));};exports['getHoppers']=function(_0x1b4b64,_0x51ad6d,_0x30b3f2){var _0xc17fee={'raw':!![],'where':{}};var _0x2d8a39={};var _0x46cb18={'count':0x0,'rows':[]};return db['Campaign'][_0x0f15('0x55')]({'where':{'id':_0x1b4b64[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x51ad6d,null))[_0x0f15('0x1f')](function(_0x4408e){if(_0x4408e){_0x2d8a39[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x56')][_0x0f15('0x44')]);_0x2d8a39[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x1b4b64[_0x0f15('0x2d')]);_0x2d8a39[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x2d8a39[_0x0f15('0x30')],_0x2d8a39['query']);_0xc17fee[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x2d8a39[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x1b4b64['query'][_0x0f15('0x31')]));_0xc17fee['attributes']=_0xc17fee[_0x0f15('0x32')][_0x0f15('0x33')]?_0xc17fee[_0x0f15('0x32')]:_0x2d8a39[_0x0f15('0x30')];if(!_0x1b4b64['query'][_0x0f15('0x34')](_0x0f15('0x35'))){_0xc17fee[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x1b4b64[_0x0f15('0x2d')]['limit']);_0xc17fee[_0x0f15('0x19')]=qs['offset'](_0x1b4b64['query'][_0x0f15('0x19')]);}_0xc17fee['order']=qs[_0x0f15('0x36')](_0x1b4b64['query'][_0x0f15('0x36')]);_0xc17fee[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x1b4b64[_0x0f15('0x2d')],_0x2d8a39['filters']));_0xc17fee[_0x0f15('0x37')][_0x0f15('0x57')]=_0x4408e['id'];if(_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x39')]){_0xc17fee['where']=_[_0x0f15('0x3a')](_0xc17fee[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0xc17fee[_0x0f15('0x32')],function(_0x537f80){var _0x370c04={};_0x370c04[_0x537f80]={'$like':'%'+_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x370c04;})});}_0xc17fee=_[_0x0f15('0x3a')]({},_0xc17fee,_0x1b4b64[_0x0f15('0x3c')]);return db[_0x0f15('0x56')][_0x0f15('0x1c')]({'where':_0xc17fee[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x51082a){_0x46cb18['count']=_0x51082a;if(_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0xc17fee[_0x0f15('0x3e')]=[{'all':!![]}];}return db[_0x0f15('0x56')]['findAll'](_0xc17fee);})[_0x0f15('0x1f')](function(_0x2b0fd6){_0x46cb18[_0x0f15('0x40')]=_0x2b0fd6;return _0x46cb18;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x51ad6d,_0xc17fee))['catch'](handleError(_0x51ad6d,null));};exports[_0x0f15('0x58')]=function(_0xad1b45,_0x388c62,_0x1319fd){var _0x1e198c={'raw':!![],'where':{}};var _0x26ee7b={};var _0x22ac0e={'count':0x0,'rows':[]};return db[_0x0f15('0x2a')][_0x0f15('0x55')]({'where':{'id':_0xad1b45[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x388c62,null))[_0x0f15('0x1f')](function(_0x24cd99){if(_0x24cd99){_0x26ee7b['model']=_['keys'](db[_0x0f15('0x59')]['rawAttributes']);_0x26ee7b[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0xad1b45['query']);_0x26ee7b[_0x0f15('0x2e')]=_['intersection'](_0x26ee7b['model'],_0x26ee7b[_0x0f15('0x2d')]);_0x1e198c[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x26ee7b[_0x0f15('0x30')],qs['fields'](_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x1e198c[_0x0f15('0x32')]=_0x1e198c[_0x0f15('0x32')]['length']?_0x1e198c[_0x0f15('0x32')]:_0x26ee7b[_0x0f15('0x30')];if(!_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x1e198c[_0x0f15('0x1b')]=qs['limit'](_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x1e198c[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0xad1b45['query']['offset']);}_0x1e198c[_0x0f15('0x5a')]=qs[_0x0f15('0x36')](_0xad1b45['query'][_0x0f15('0x36')]);_0x1e198c[_0x0f15('0x37')]=qs['filters'](_['pick'](_0xad1b45[_0x0f15('0x2d')],_0x26ee7b[_0x0f15('0x2e')]));_0x1e198c[_0x0f15('0x37')]['CampaignId']=_0x24cd99['id'];if(_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x39')]){_0x1e198c[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x1e198c[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x1e198c[_0x0f15('0x32')],function(_0x1166ef){var _0x467368={};_0x467368[_0x1166ef]={'$like':'%'+_0xad1b45[_0x0f15('0x2d')]['filter']+'%'};return _0x467368;})});}_0x1e198c=_['merge']({},_0x1e198c,_0xad1b45[_0x0f15('0x3c')]);return db[_0x0f15('0x59')]['count']({'where':_0x1e198c[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x33861b){_0x22ac0e[_0x0f15('0x1c')]=_0x33861b;if(_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x1e198c[_0x0f15('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0f15('0x3f')](_0x1e198c);})[_0x0f15('0x1f')](function(_0x55ee1e){_0x22ac0e[_0x0f15('0x40')]=_0x55ee1e;return _0x22ac0e;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x388c62,_0x1e198c))[_0x0f15('0x41')](handleError(_0x388c62,null));};exports['getHopperFinals']=function(_0x3e5ab0,_0xf82f66,_0x331300){var _0x2571e8={'raw':!![],'where':{}};var _0x1c2ed7={};var _0x5ad3c5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3e5ab0[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0xf82f66,null))['then'](function(_0x52bea2){if(_0x52bea2){_0x1c2ed7[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db['CmHopperFinal']['rawAttributes']);_0x1c2ed7[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x3e5ab0[_0x0f15('0x2d')]);_0x1c2ed7[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x1c2ed7[_0x0f15('0x30')],_0x1c2ed7['query']);_0x2571e8['attributes']=_['intersection'](_0x1c2ed7[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x2571e8['attributes']=_0x2571e8[_0x0f15('0x32')]['length']?_0x2571e8['attributes']:_0x1c2ed7[_0x0f15('0x30')];if(!_0x3e5ab0['query'][_0x0f15('0x34')](_0x0f15('0x35'))){_0x2571e8[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x3e5ab0[_0x0f15('0x2d')]['limit']);_0x2571e8[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x19')]);}_0x2571e8['order']=qs[_0x0f15('0x36')](_0x3e5ab0['query'][_0x0f15('0x36')]);_0x2571e8[_0x0f15('0x37')]=qs['filters'](_[_0x0f15('0x38')](_0x3e5ab0[_0x0f15('0x2d')],_0x1c2ed7['filters']));_0x2571e8[_0x0f15('0x37')][_0x0f15('0x57')]=_0x52bea2['id'];if(_0x3e5ab0[_0x0f15('0x2d')]['filter']){_0x2571e8[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x2571e8[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x2571e8[_0x0f15('0x32')],function(_0x69aca7){var _0x9f511c={};_0x9f511c[_0x69aca7]={'$like':'%'+_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x9f511c;})});}_0x2571e8=_[_0x0f15('0x3a')]({},_0x2571e8,_0x3e5ab0[_0x0f15('0x3c')]);return db[_0x0f15('0x5b')][_0x0f15('0x1c')]({'where':_0x2571e8[_0x0f15('0x37')]})['then'](function(_0x4a68a8){_0x5ad3c5[_0x0f15('0x1c')]=_0x4a68a8;if(_0x3e5ab0['query'][_0x0f15('0x3d')]){_0x2571e8[_0x0f15('0x3e')]=[{'all':!![]}];}return db[_0x0f15('0x5b')][_0x0f15('0x3f')](_0x2571e8);})['then'](function(_0x352f5d){_0x5ad3c5['rows']=_0x352f5d;return _0x5ad3c5;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0xf82f66,_0x2571e8))[_0x0f15('0x41')](handleError(_0xf82f66,null));};exports[_0x0f15('0x5c')]=function(_0xc8d0cb,_0x198650,_0x50f2ea){var _0x4286d6={'raw':!![],'where':{}};var _0x26a1b2={};var _0x3ec85d={'count':0x0,'rows':[]};return db[_0x0f15('0x2a')]['findOne']({'where':{'id':_0xc8d0cb[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x198650,null))[_0x0f15('0x1f')](function(_0x21bce5){if(_0x21bce5){_0x26a1b2[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x5d')]['rawAttributes']);_0x26a1b2[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0xc8d0cb[_0x0f15('0x2d')]);_0x26a1b2[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x26a1b2['model'],_0x26a1b2[_0x0f15('0x2d')]);_0x4286d6['attributes']=_[_0x0f15('0x2f')](_0x26a1b2[_0x0f15('0x30')],qs['fields'](_0xc8d0cb['query'][_0x0f15('0x31')]));_0x4286d6[_0x0f15('0x32')]=_0x4286d6['attributes']['length']?_0x4286d6[_0x0f15('0x32')]:_0x26a1b2['model'];if(!_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x4286d6[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x4286d6['offset']=qs[_0x0f15('0x19')](_0xc8d0cb[_0x0f15('0x2d')]['offset']);}_0x4286d6[_0x0f15('0x5a')]=qs[_0x0f15('0x36')](_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x36')]);_0x4286d6['where']=qs[_0x0f15('0x2e')](_['pick'](_0xc8d0cb[_0x0f15('0x2d')],_0x26a1b2[_0x0f15('0x2e')]));_0x4286d6[_0x0f15('0x37')][_0x0f15('0x57')]=_0x21bce5['id'];if(_0xc8d0cb[_0x0f15('0x2d')]['filter']){_0x4286d6['where']=_['merge'](_0x4286d6[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x4286d6[_0x0f15('0x32')],function(_0x1b6554){var _0x3789a5={};_0x3789a5[_0x1b6554]={'$like':'%'+_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x3789a5;})});}_0x4286d6=_['merge']({},_0x4286d6,_0xc8d0cb[_0x0f15('0x3c')]);return db[_0x0f15('0x5d')][_0x0f15('0x1c')]({'where':_0x4286d6[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x3f3608){_0x3ec85d[_0x0f15('0x1c')]=_0x3f3608;if(_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x4286d6[_0x0f15('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4286d6);})[_0x0f15('0x1f')](function(_0x279ac5){_0x3ec85d[_0x0f15('0x40')]=_0x279ac5;return _0x3ec85d;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x198650,_0x4286d6))[_0x0f15('0x41')](handleError(_0x198650,null));};exports['getLists']=function(_0x40e1e4,_0x45db14,_0x2f1969){var _0x33b2f2={};var _0x2b72a7={};var _0x3c0387;var _0x20b219;return db[_0x0f15('0x2a')][_0x0f15('0x55')]({'where':{'id':_0x40e1e4[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x45db14,null))[_0x0f15('0x1f')](function(_0x21deec){if(_0x21deec){_0x3c0387=_0x21deec;_0x2b72a7[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x5e')]['rawAttributes']);_0x2b72a7[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x40e1e4[_0x0f15('0x2d')]);_0x2b72a7[_0x0f15('0x2e')]=_['intersection'](_0x2b72a7[_0x0f15('0x30')],_0x2b72a7[_0x0f15('0x2d')]);_0x33b2f2[_0x0f15('0x32')]=_['intersection'](_0x2b72a7[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x33b2f2['attributes']=_0x33b2f2['attributes'][_0x0f15('0x33')]?_0x33b2f2[_0x0f15('0x32')]:_0x2b72a7['model'];_0x33b2f2['order']=qs[_0x0f15('0x36')](_0x40e1e4['query'][_0x0f15('0x36')]);_0x33b2f2[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x40e1e4[_0x0f15('0x2d')],_0x2b72a7[_0x0f15('0x2e')]));if(_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x39')]){_0x33b2f2[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x33b2f2[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x33b2f2[_0x0f15('0x32')],function(_0x21e48c){var _0x587cde={};_0x587cde[_0x21e48c]={'$like':'%'+_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x587cde;})});}_0x33b2f2=_[_0x0f15('0x3a')]({},_0x33b2f2,_0x40e1e4[_0x0f15('0x3c')]);return _0x3c0387['getLists'](_0x33b2f2);}})[_0x0f15('0x1f')](function(_0x1a3352){if(_0x1a3352){_0x20b219=_0x1a3352[_0x0f15('0x33')];if(!_0x40e1e4[_0x0f15('0x2d')]['hasOwnProperty']('nolimit')){_0x33b2f2['limit']=qs[_0x0f15('0x1b')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x33b2f2[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x19')]);}return _0x3c0387['getLists'](_0x33b2f2);}})[_0x0f15('0x1f')](function(_0x3442d6){if(_0x3442d6){return _0x3442d6?{'count':_0x20b219,'rows':_0x3442d6}:null;}})[_0x0f15('0x1f')](respondWithResult(_0x45db14,null))[_0x0f15('0x41')](handleError(_0x45db14,null));};exports[_0x0f15('0x5f')]=function(_0x4b3747,_0x2da705,_0x62a577){var _0x38bd84,_0xadcce8;var _0x1ec4fb=[];var _0x4ea4a3=moment()['format'](_0x0f15('0x60'));return db['Campaign'][_0x0f15('0x45')]({'where':{'id':_0x4b3747['params']['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x2da705,null))[_0x0f15('0x1f')](function(_0x284d9a){if(_0x284d9a){_0xadcce8=_0x284d9a;return _0x284d9a[_0x0f15('0x5f')](_0x4b3747[_0x0f15('0x47')][_0x0f15('0x61')],_['omit'](_0x4b3747['body'],['ids','id'])||{});}return null;})[_0x0f15('0x62')](function(_0x342516){var _0x30c890;var _0x3d985c;_0x38bd84=_0x342516||[];var _0x2382ab=[];if(_0x342516){for(var _0x54bdc6=0x0;_0x54bdc6<_0x342516['length'];_0x54bdc6+=0x1){var _0x1f2a6f=_0x342516[_0x54bdc6][_0x0f15('0x21')]({'plain':!![]});_0xadcce8[_0x0f15('0x63')]=_0x4b3747[_0x0f15('0x47')][_0x0f15('0x63')]?_0x4b3747[_0x0f15('0x47')][_0x0f15('0x63')]:_0xadcce8[_0x0f15('0x63')];switch(_0xadcce8[_0x0f15('0x63')]){case'always':_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x66'))[_0x0f15('0x67')]([_0x0f15('0x68'),'scheduledAt',_0x0f15('0x69'),_0x0f15('0x6a'),'CampaignId',_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')]('phone',_0x0f15('0x68'))[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')]('id','ContactId')[_0x0f15('0x6c')](_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')](),_0x0f15('0x6a'))['field'](_0x4b3747[_0x0f15('0x43')]['id']['toString'](),'CampaignId')[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')](_0x0f15('0x73'))[_0x0f15('0x37')]('ListId\x20=\x20?',_0x1f2a6f['CmListId'][_0x0f15('0x70')]())[_0x0f15('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x0f15('0x37')](_0x0f15('0x74'),squel['select']()[_0x0f15('0x6c')](_0x0f15('0x75'))[_0x0f15('0x71')](_0x0f15('0x76'))[_0x0f15('0x37')](_0x0f15('0x77'),_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')]()))['where'](_0x0f15('0x74'),squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')](_0x0f15('0x78'))[_0x0f15('0x71')](_0x0f15('0x66'))[_0x0f15('0x37')]('CampaignId\x20=\x20?',_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')]())))[_0x0f15('0x70')]();break;case _0x0f15('0x79'):_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')]('cm_hopper')[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x6e'),_0x0f15('0x69'),_0x0f15('0x6a'),_0x0f15('0x57'),'createdAt',_0x0f15('0x52')],squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')]('phone',_0x0f15('0x68'))['field'](_0x0f15('0x6d'),'scheduledAt')[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x1f2a6f[_0x0f15('0x6f')]['toString'](),'ListId')[_0x0f15('0x6c')](_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')]('deletedAt\x20IS\x20NULL')[_0x0f15('0x37')](_0x0f15('0x7a'),_0x1f2a6f['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0f15('0x37')](_0x0f15('0x74'),squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')](_0x0f15('0x78'))['from'](_0x0f15('0x66'))[_0x0f15('0x37')](_0x0f15('0x77'),_0x4b3747['params']['id'][_0x0f15('0x70')]())))[_0x0f15('0x70')]();break;default:_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x66'))[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x6e'),'ContactId',_0x0f15('0x6a'),_0x0f15('0x57'),_0x0f15('0x51'),_0x0f15('0x52')],squel['select']()[_0x0f15('0x6c')](_0x0f15('0x68'),'phone')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')](),_0x0f15('0x6a'))[_0x0f15('0x6c')](_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27','createdAt')[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27','updatedAt')[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')](_0x0f15('0x73'))[_0x0f15('0x37')](_0x0f15('0x7a'),_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')]())['where'](_0x0f15('0x7b')))[_0x0f15('0x70')]();}_0x3d985c=squel[_0x0f15('0x64')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x0f15('0x7c'),_0x0f15('0x6e'),_0x0f15('0x68'),'OrderBy',_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()['field'](_0x0f15('0x7d'),'id')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')](_0x0f15('0x7e'),_0x0f15('0x68'))[_0x0f15('0x6c')](_0x0f15('0x7f'),_0x0f15('0x80'))['field']('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x81'),'ci')[_0x0f15('0x82')]('cm_hopper','h',_0x0f15('0x83'))[_0x0f15('0x37')](_0x0f15('0x84'),_0x1f2a6f[_0x0f15('0x6f')]['toString']())[_0x0f15('0x37')](_0x0f15('0x85'),_0x4b3747[_0x0f15('0x43')]['id']['toString']())[_0x0f15('0x37')](_0x0f15('0x86'),_0x4ea4a3))[_0x0f15('0x70')]();_0x2382ab[_0x0f15('0x87')](db['sequelize'][_0x0f15('0x2d')](_0x30c890));_0x1ec4fb[_0x0f15('0x87')](db[_0x0f15('0x88')][_0x0f15('0x2d')](_0x3d985c));}return BPromise[_0x0f15('0x89')](_0x2382ab);}})[_0x0f15('0x1f')](function(){return BPromise[_0x0f15('0x89')](_0x1ec4fb);})[_0x0f15('0x1f')](function(){return _0x38bd84;})[_0x0f15('0x1f')](respondWithResult(_0x2da705,null))[_0x0f15('0x41')](handleError(_0x2da705,null));};exports[_0x0f15('0x8a')]=function(_0x5e1ec9,_0x4a291e,_0x361b46){return db[_0x0f15('0x2a')][_0x0f15('0x45')]({'where':{'id':_0x5e1ec9[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x4a291e,null))['then'](function(_0x593b4a){if(_0x593b4a){return _0x593b4a[_0x0f15('0x8a')](_0x5e1ec9[_0x0f15('0x2d')][_0x0f15('0x61')]);}})[_0x0f15('0x1f')](function(_0x42e655){if(_0x42e655){return db[_0x0f15('0x56')][_0x0f15('0x20')]({'where':{'ListId':_0x5e1ec9[_0x0f15('0x2d')]['ids'],'CampaignId':_0x5e1ec9[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](function(){return _0x42e655;});}})[_0x0f15('0x1f')](respondWithStatusCode(_0x4a291e,null))[_0x0f15('0x41')](handleError(_0x4a291e,null));};exports[_0x0f15('0x8b')]=function(_0x2d7b10,_0x4c5fce,_0x18d4a0){var _0x4cdf30={};var _0x31b1be={};var _0x32f15b;var _0x181426;return db['Campaign']['findOne']({'where':{'id':_0x2d7b10[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c5fce,null))[_0x0f15('0x1f')](function(_0x9e1991){if(_0x9e1991){_0x32f15b=_0x9e1991;_0x31b1be[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db['CmList'][_0x0f15('0x44')]);_0x31b1be['query']=_['keys'](_0x2d7b10[_0x0f15('0x2d')]);_0x31b1be[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x31b1be[_0x0f15('0x30')],_0x31b1be[_0x0f15('0x2d')]);_0x4cdf30['attributes']=_['intersection'](_0x31b1be['model'],qs['fields'](_0x2d7b10['query'][_0x0f15('0x31')]));_0x4cdf30['attributes']=_0x4cdf30[_0x0f15('0x32')]['length']?_0x4cdf30[_0x0f15('0x32')]:_0x31b1be[_0x0f15('0x30')];_0x4cdf30['order']=qs[_0x0f15('0x36')](_0x2d7b10['query'][_0x0f15('0x36')]);_0x4cdf30[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_['pick'](_0x2d7b10[_0x0f15('0x2d')],_0x31b1be[_0x0f15('0x2e')]));if(_0x2d7b10[_0x0f15('0x2d')]['filter']){_0x4cdf30[_0x0f15('0x37')]=_['merge'](_0x4cdf30['where'],{'$or':_[_0x0f15('0x29')](_0x4cdf30[_0x0f15('0x32')],function(_0x3e68a6){var _0x43024f={};_0x43024f[_0x3e68a6]={'$like':'%'+_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x43024f;})});}_0x4cdf30=_[_0x0f15('0x3a')]({},_0x4cdf30,_0x2d7b10[_0x0f15('0x3c')]);return _0x32f15b[_0x0f15('0x8b')](_0x4cdf30);}})['then'](function(_0xf4d29b){if(_0xf4d29b){_0x181426=_0xf4d29b[_0x0f15('0x33')];if(!_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x4cdf30[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x4cdf30[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x2d7b10['query'][_0x0f15('0x19')]);}return _0x32f15b['getBlackLists'](_0x4cdf30);}})[_0x0f15('0x1f')](function(_0x5e4c0e){if(_0x5e4c0e){return _0x5e4c0e?{'count':_0x181426,'rows':_0x5e4c0e}:null;}})['then'](respondWithResult(_0x4c5fce,null))['catch'](handleError(_0x4c5fce,null));};exports[_0x0f15('0x8c')]=function(_0x76969a,_0x5488b7,_0x3d0fa2){var _0x1aefa1,_0x4ed614;var _0x52dc22=[];var _0x13af67=moment()[_0x0f15('0x8d')](_0x0f15('0x60'));return db[_0x0f15('0x2a')][_0x0f15('0x45')]({'where':{'id':_0x76969a['params']['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x5488b7,null))[_0x0f15('0x1f')](function(_0x3f051f){if(_0x3f051f){_0x4ed614=_0x3f051f;return _0x3f051f[_0x0f15('0x8c')](_0x76969a['body'][_0x0f15('0x61')],_[_0x0f15('0x50')](_0x76969a[_0x0f15('0x47')],[_0x0f15('0x61'),'id'])||{});}return null;})[_0x0f15('0x62')](function(_0x51e994){var _0x4f85ec;var _0x2ec92a;_0x1aefa1=_0x51e994||[];var _0x2996bd=[];if(_0x51e994){for(var _0x36d9c0=0x0;_0x36d9c0<_0x51e994['length'];_0x36d9c0+=0x1){var _0x23c9c6=_0x51e994[_0x36d9c0][_0x0f15('0x21')]({'plain':!![]});_0x4f85ec=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x8e'))[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x69'),_0x0f15('0x6a'),_0x0f15('0x57'),_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()['field'](_0x0f15('0x68'),'phone')[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x23c9c6[_0x0f15('0x6f')][_0x0f15('0x70')](),'ListId')['field'](_0x76969a[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')](_0x0f15('0x6d'),'createdAt')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x52'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x0f15('0x37')]('ListId\x20=\x20?',_0x23c9c6[_0x0f15('0x6f')][_0x0f15('0x70')]())[_0x0f15('0x37')](_0x0f15('0x7b')))['toString']();_0x2996bd[_0x0f15('0x87')](db[_0x0f15('0x88')][_0x0f15('0x2d')](_0x4f85ec));}return BPromise[_0x0f15('0x89')](_0x2996bd);}})[_0x0f15('0x1f')](function(){return _0x1aefa1;})[_0x0f15('0x1f')](respondWithResult(_0x5488b7,null))[_0x0f15('0x41')](handleError(_0x5488b7,null));};exports[_0x0f15('0x8f')]=function(_0x625c73,_0x5f0f4b,_0x589af0){return db[_0x0f15('0x2a')]['find']({'where':{'id':_0x625c73[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x5f0f4b,null))[_0x0f15('0x1f')](function(_0x28662c){if(_0x28662c){return _0x28662c[_0x0f15('0x8f')](_0x625c73['query'][_0x0f15('0x61')]);}})[_0x0f15('0x1f')](function(_0xd86a3){if(_0xd86a3){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x625c73[_0x0f15('0x2d')][_0x0f15('0x61')],'CampaignId':_0x625c73['params']['id']}})[_0x0f15('0x1f')](function(){return _0xd86a3;});}})['then'](respondWithStatusCode(_0x5f0f4b,null))[_0x0f15('0x41')](handleError(_0x5f0f4b,null));};
\ No newline at end of file