Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / faxAccount / faxAccount.controller.js
index 7976eb8..f3cb210 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea29=['FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','TrunkId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','CmContact','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','key','map','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition'];(function(_0x1ce979,_0x1dc8aa){var _0x5cd3f1=function(_0xcf768){while(--_0xcf768){_0x1ce979['push'](_0x1ce979['shift']());}};_0x5cd3f1(++_0x1dc8aa);}(_0xea29,0x1ed));var _0x9ea2=function(_0x494368,_0x56d9a3){_0x494368=_0x494368-0x0;var _0x1491a3=_0xea29[_0x494368];return _0x1491a3;};'use strict';var emlformat=require(_0x9ea2('0x0'));var rimraf=require(_0x9ea2('0x1'));var zipdir=require(_0x9ea2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ea2('0x3'));var moment=require('moment');var BPromise=require(_0x9ea2('0x4'));var Mustache=require(_0x9ea2('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9ea2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ea2('0x7'));var _=require(_0x9ea2('0x8'));var squel=require(_0x9ea2('0x9'));var crypto=require(_0x9ea2('0xa'));var jsforce=require(_0x9ea2('0xb'));var deskjs=require(_0x9ea2('0xc'));var toCsv=require(_0x9ea2('0x6'));var querystring=require(_0x9ea2('0xd'));var Papa=require(_0x9ea2('0xe'));var Redis=require(_0x9ea2('0xf'));var authService=require(_0x9ea2('0x10'));var qs=require(_0x9ea2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ea2('0x12'));var logger=require(_0x9ea2('0x13'))(_0x9ea2('0x14'));var utils=require(_0x9ea2('0x15'));var config=require(_0x9ea2('0x16'));var licenseUtil=require(_0x9ea2('0x17'));var db=require(_0x9ea2('0x18'))['db'];config[_0x9ea2('0x19')]=_[_0x9ea2('0x1a')](config['redis'],{'host':_0x9ea2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ea2('0x19')]));require(_0x9ea2('0x1c'))[_0x9ea2('0x1d')](socket);var jayson=require(_0x9ea2('0x1e'));var client=jayson['client'][_0x9ea2('0x1f')]({'port':0x232c});var client9002=jayson[_0x9ea2('0x20')][_0x9ea2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x366766,_0x15ca6a,_0x2dca0b,_0x172489){return new BPromise(function(_0x3cdf7c,_0x3b6fd4){var _0x49487a=_0x172489||client;return _0x49487a[_0x9ea2('0x21')](_0x366766,_0x2dca0b)['then'](function(_0x56515a){logger[_0x9ea2('0x22')](_0x9ea2('0x23'),_0x15ca6a,_0x9ea2('0x24'));logger['debug'](_0x9ea2('0x25'),_0x15ca6a,_0x9ea2('0x24'),JSON[_0x9ea2('0x26')](_0x56515a));if(_0x56515a[_0x9ea2('0x27')]){if(_0x56515a['error'][_0x9ea2('0x28')]===0x1f4){logger[_0x9ea2('0x27')](_0x9ea2('0x23'),_0x15ca6a,_0x56515a[_0x9ea2('0x27')][_0x9ea2('0x29')]);return _0x3b6fd4(_0x56515a['error'][_0x9ea2('0x29')]);}logger['error'](_0x9ea2('0x23'),_0x15ca6a,_0x56515a['error'][_0x9ea2('0x29')]);return _0x3cdf7c(_0x56515a[_0x9ea2('0x27')][_0x9ea2('0x29')]);}else{logger['info'](_0x9ea2('0x23'),_0x15ca6a,_0x9ea2('0x24'));_0x3cdf7c(_0x56515a[_0x9ea2('0x2a')]['message']);}})[_0x9ea2('0x2b')](function(_0x3265ff){logger[_0x9ea2('0x27')](_0x9ea2('0x23'),_0x15ca6a,_0x3265ff);_0x3b6fd4(_0x3265ff);});});}function respondWithStatusCode(_0x425768,_0x4f57ca){_0x4f57ca=_0x4f57ca||0xcc;return function(_0x5875c8){if(_0x5875c8){return _0x425768['sendStatus'](_0x4f57ca);}return _0x425768[_0x9ea2('0x2c')](_0x4f57ca)[_0x9ea2('0x2d')]();};}function respondWithResult(_0x49f22c,_0x36576e){_0x36576e=_0x36576e||0xc8;return function(_0xfcb9f0){if(_0xfcb9f0){return _0x49f22c[_0x9ea2('0x2c')](_0x36576e)[_0x9ea2('0x2e')](_0xfcb9f0);}};}function respondWithFilteredResult(_0x22fc3d,_0x2a38ae){return function(_0x1a69b3){if(_0x1a69b3){var _0x5dc8e7=typeof _0x2a38ae[_0x9ea2('0x2f')]===_0x9ea2('0x30')&&typeof _0x2a38ae[_0x9ea2('0x31')]===_0x9ea2('0x30');var _0x198223=_0x1a69b3[_0x9ea2('0x32')];var _0x27b96f=_0x5dc8e7?0x0:_0x2a38ae[_0x9ea2('0x2f')];var _0x526e18=_0x5dc8e7?_0x1a69b3[_0x9ea2('0x32')]:_0x2a38ae[_0x9ea2('0x2f')]+_0x2a38ae[_0x9ea2('0x31')];var _0x3b8c28;if(_0x526e18>=_0x198223){_0x526e18=_0x198223;_0x3b8c28=0xc8;}else{_0x3b8c28=0xce;}_0x22fc3d[_0x9ea2('0x2c')](_0x3b8c28);return _0x22fc3d[_0x9ea2('0x33')]('Content-Range',_0x27b96f+'-'+_0x526e18+'/'+_0x198223)[_0x9ea2('0x2e')](_0x1a69b3);}return null;};}function patchUpdates(_0x1e2b3b){return function(_0x12e453){try{jsonpatch[_0x9ea2('0x34')](_0x12e453,_0x1e2b3b,!![]);}catch(_0x4926db){return BPromise[_0x9ea2('0x35')](_0x4926db);}return _0x12e453[_0x9ea2('0x36')]();};}function saveUpdates(_0x52ffa1,_0x38cf07){return function(_0x3d9d4a){if(_0x3d9d4a){return _0x3d9d4a[_0x9ea2('0x37')](_0x52ffa1)[_0x9ea2('0x38')](function(_0x3d9098){return _0x3d9098;});}return null;};}function removeEntity(_0x2e21f3,_0x5e34de){return function(_0x432651){if(_0x432651){return _0x432651[_0x9ea2('0x39')]()[_0x9ea2('0x38')](function(){var _0x4d04ae=_0x432651['get']({'plain':!![]});var _0x2daeb3=_0x9ea2('0x3a');return db[_0x9ea2('0x3b')]['destroy']({'where':{'type':_0x2daeb3,'resourceId':_0x4d04ae['id']}})[_0x9ea2('0x38')](function(){return _0x432651;});})[_0x9ea2('0x38')](function(){_0x2e21f3[_0x9ea2('0x2c')](0xcc)[_0x9ea2('0x2d')]();});}};}function handleEntityNotFound(_0x48fc8b,_0x2489da){return function(_0x2733d2){if(!_0x2733d2){_0x48fc8b[_0x9ea2('0x3c')](0x194);}return _0x2733d2;};}function handleError(_0xfa8d7,_0x14a5eb){_0x14a5eb=_0x14a5eb||0x1f4;return function(_0xede113){logger[_0x9ea2('0x27')](_0xede113[_0x9ea2('0x3d')]);if(_0xede113[_0x9ea2('0x3e')]){delete _0xede113[_0x9ea2('0x3e')];}_0xfa8d7[_0x9ea2('0x2c')](_0x14a5eb)[_0x9ea2('0x3f')](_0xede113);};}exports[_0x9ea2('0x40')]=function(_0x328436,_0x3ea8e4){var _0x1cf82c={'include':[{'model':db[_0x9ea2('0x41')],'as':_0x9ea2('0x42')}]},_0x49481c={},_0x1f2f70={'count':0x0,'rows':[]};var _0x1762e1=_['map'](db[_0x9ea2('0x43')]['rawAttributes'],function(_0x413667){return{'name':_0x413667[_0x9ea2('0x44')],'type':_0x413667['type'][_0x9ea2('0x45')]};});_0x49481c['model']=_[_0x9ea2('0x46')](_0x1762e1,_0x9ea2('0x3e'));_0x49481c['query']=_['keys'](_0x328436[_0x9ea2('0x47')]);_0x49481c['filters']=_['intersection'](_0x49481c[_0x9ea2('0x48')],_0x49481c[_0x9ea2('0x47')]);_0x1cf82c[_0x9ea2('0x49')]=_[_0x9ea2('0x4a')](_0x49481c[_0x9ea2('0x48')],qs[_0x9ea2('0x4b')](_0x328436['query']['fields']));_0x1cf82c['attributes']=_0x1cf82c[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x1cf82c[_0x9ea2('0x49')]:_0x49481c[_0x9ea2('0x48')];if(!_0x328436[_0x9ea2('0x47')]['hasOwnProperty'](_0x9ea2('0x4d'))){_0x1cf82c['limit']=qs[_0x9ea2('0x31')](_0x328436[_0x9ea2('0x47')][_0x9ea2('0x31')]);_0x1cf82c[_0x9ea2('0x2f')]=qs['offset'](_0x328436[_0x9ea2('0x47')][_0x9ea2('0x2f')]);}_0x1cf82c[_0x9ea2('0x4e')]=qs[_0x9ea2('0x4f')](_0x328436[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x1cf82c[_0x9ea2('0x50')]=qs[_0x9ea2('0x51')](_[_0x9ea2('0x52')](_0x328436['query'],_0x49481c[_0x9ea2('0x51')]),_0x1762e1);if(_0x328436[_0x9ea2('0x47')]['filter']){_0x1cf82c[_0x9ea2('0x50')]=_[_0x9ea2('0x53')](_0x1cf82c[_0x9ea2('0x50')],{'$or':_[_0x9ea2('0x46')](_0x1762e1,function(_0x282e62){if(_0x282e62['type']!=='VIRTUAL'){var _0xf548fa={};_0xf548fa[_0x282e62[_0x9ea2('0x3e')]]={'$like':'%'+_0x328436[_0x9ea2('0x47')][_0x9ea2('0x54')]+'%'};return _0xf548fa;}})});}_0x1cf82c=_['merge']({},_0x1cf82c,_0x328436[_0x9ea2('0x55')]);var _0x40fbf8={'where':_0x1cf82c[_0x9ea2('0x50')]};return db['FaxAccount'][_0x9ea2('0x32')](_0x40fbf8)[_0x9ea2('0x38')](function(_0x5e03d7){_0x1f2f70[_0x9ea2('0x32')]=_0x5e03d7;if(_0x328436['query'][_0x9ea2('0x56')]){_0x1cf82c[_0x9ea2('0x57')]=[{'all':!![]}];}return db[_0x9ea2('0x43')][_0x9ea2('0x58')](_0x1cf82c);})[_0x9ea2('0x38')](function(_0xa3879f){_0x1f2f70[_0x9ea2('0x59')]=_0xa3879f;return _0x1f2f70;})['then'](respondWithFilteredResult(_0x3ea8e4,_0x1cf82c))[_0x9ea2('0x2b')](handleError(_0x3ea8e4,null));};exports[_0x9ea2('0x5a')]=function(_0x3aa84f,_0x304177){var _0x5f8b9c={'raw':![],'where':{'id':_0x3aa84f[_0x9ea2('0x5b')]['id']},'include':[{'model':db[_0x9ea2('0x41')],'as':_0x9ea2('0x42')}]},_0x26f465={};_0x26f465[_0x9ea2('0x48')]=_['keys'](db['FaxAccount'][_0x9ea2('0x5c')]);_0x26f465[_0x9ea2('0x47')]=_[_0x9ea2('0x5d')](_0x3aa84f[_0x9ea2('0x47')]);_0x26f465['filters']=_['intersection'](_0x26f465[_0x9ea2('0x48')],_0x26f465[_0x9ea2('0x47')]);_0x5f8b9c[_0x9ea2('0x49')]=_['intersection'](_0x26f465['model'],qs[_0x9ea2('0x4b')](_0x3aa84f['query'][_0x9ea2('0x4b')]));_0x5f8b9c[_0x9ea2('0x49')]=_0x5f8b9c[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x5f8b9c[_0x9ea2('0x49')]:_0x26f465['model'];if(_0x3aa84f[_0x9ea2('0x47')][_0x9ea2('0x56')]){_0x5f8b9c[_0x9ea2('0x57')]=[{'all':!![]}];}_0x5f8b9c=_[_0x9ea2('0x53')]({},_0x5f8b9c,_0x3aa84f[_0x9ea2('0x55')]);return db['FaxAccount'][_0x9ea2('0x5e')](_0x5f8b9c)[_0x9ea2('0x38')](handleEntityNotFound(_0x304177,null))[_0x9ea2('0x38')](respondWithResult(_0x304177,null))[_0x9ea2('0x2b')](handleError(_0x304177,null));};exports[_0x9ea2('0x5f')]=function(_0x140112,_0x2961a2){return db[_0x9ea2('0x43')]['create'](_0x140112[_0x9ea2('0x60')],{})[_0x9ea2('0x38')](function(_0x10d6c4){var _0x56adee=_0x140112[_0x9ea2('0x61')]['get']({'plain':!![]});if(!_0x56adee)throw new Error(_0x9ea2('0x62'));if(_0x56adee[_0x9ea2('0x63')]===_0x9ea2('0x61')){var _0x54a2fc=_0x10d6c4[_0x9ea2('0x64')]({'plain':!![]});var _0x47fc2a=_0x9ea2('0x3a');return db[_0x9ea2('0x65')][_0x9ea2('0x5e')]({'where':{'name':_0x47fc2a,'userProfileId':_0x56adee[_0x9ea2('0x66')]},'raw':!![]})[_0x9ea2('0x38')](function(_0x43a305){if(_0x43a305&&_0x43a305[_0x9ea2('0x67')]===0x0){return db[_0x9ea2('0x3b')][_0x9ea2('0x5f')]({'name':_0x54a2fc['name'],'resourceId':_0x54a2fc['id'],'type':_0x43a305['name'],'sectionId':_0x43a305['id']},{})['then'](function(){return _0x10d6c4;});}else{return _0x10d6c4;}})[_0x9ea2('0x2b')](function(_0x5df2ed){logger[_0x9ea2('0x27')](_0x9ea2('0x68'),_0x5df2ed);throw _0x5df2ed;});}return _0x10d6c4;})[_0x9ea2('0x38')](respondWithResult(_0x2961a2,0xc9))[_0x9ea2('0x2b')](handleError(_0x2961a2,null));};exports[_0x9ea2('0x37')]=function(_0x52d1b7,_0x414f54){if(_0x52d1b7[_0x9ea2('0x60')]['id']){delete _0x52d1b7[_0x9ea2('0x60')]['id'];}return db[_0x9ea2('0x43')][_0x9ea2('0x5e')]({'where':{'id':_0x52d1b7[_0x9ea2('0x5b')]['id']},'include':[{'model':db[_0x9ea2('0x41')],'as':_0x9ea2('0x42')}]})[_0x9ea2('0x38')](handleEntityNotFound(_0x414f54,null))[_0x9ea2('0x38')](saveUpdates(_0x52d1b7[_0x9ea2('0x60')],null))[_0x9ea2('0x38')](respondWithResult(_0x414f54,null))[_0x9ea2('0x2b')](handleError(_0x414f54,null));};exports[_0x9ea2('0x39')]=function(_0x20e2a6,_0x55c73c){return db['FaxAccount'][_0x9ea2('0x5e')]({'where':{'id':_0x20e2a6[_0x9ea2('0x5b')]['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x55c73c,null))[_0x9ea2('0x38')](removeEntity(_0x55c73c,null))['catch'](handleError(_0x55c73c,null));};exports[_0x9ea2('0x69')]=function(_0x284c35,_0x57d482){return db[_0x9ea2('0x43')][_0x9ea2('0x69')]()[_0x9ea2('0x38')](respondWithResult(_0x57d482,null))[_0x9ea2('0x2b')](handleError(_0x57d482,null));};exports[_0x9ea2('0x6a')]=function(_0x5ce0c6,_0x5a3c26,_0x312579){if(_0x5ce0c6[_0x9ea2('0x60')]['id']){delete _0x5ce0c6[_0x9ea2('0x60')]['id'];}return db[_0x9ea2('0x43')][_0x9ea2('0x5e')]({'where':{'id':_0x5ce0c6['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x5a3c26,null))[_0x9ea2('0x38')](function(_0x1c229c){if(_0x1c229c){_0x5ce0c6[_0x9ea2('0x60')][_0x9ea2('0x6b')]=_0x1c229c['id'];return db[_0x9ea2('0x6c')]['create'](_0x5ce0c6['body']);}})[_0x9ea2('0x38')](respondWithResult(_0x5a3c26,null))[_0x9ea2('0x2b')](handleError(_0x5a3c26,null));};exports[_0x9ea2('0x6d')]=function(_0x200d59,_0x2ae061,_0x4a7c75){var _0x3333b9={'raw':![],'where':{}};var _0x2039ba={};var _0x24f517={'count':0x0,'rows':[]};return db[_0x9ea2('0x43')][_0x9ea2('0x6e')]({'where':{'id':_0x200d59[_0x9ea2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ae061,null))[_0x9ea2('0x38')](function(_0x2c6696){if(_0x2c6696){_0x2039ba[_0x9ea2('0x48')]=_[_0x9ea2('0x5d')](db[_0x9ea2('0x6c')]['rawAttributes']);_0x2039ba[_0x9ea2('0x47')]=_[_0x9ea2('0x5d')](_0x200d59[_0x9ea2('0x47')]);_0x2039ba[_0x9ea2('0x51')]=_[_0x9ea2('0x4a')](_0x2039ba[_0x9ea2('0x48')],_0x2039ba[_0x9ea2('0x47')]);_0x3333b9[_0x9ea2('0x49')]=_[_0x9ea2('0x4a')](_0x2039ba[_0x9ea2('0x48')],qs[_0x9ea2('0x4b')](_0x200d59['query'][_0x9ea2('0x4b')]));_0x3333b9['attributes']=_0x3333b9['attributes']['length']?_0x3333b9[_0x9ea2('0x49')]:_0x2039ba[_0x9ea2('0x48')];if(!_0x200d59['query'][_0x9ea2('0x6f')](_0x9ea2('0x4d'))){_0x3333b9[_0x9ea2('0x31')]=qs[_0x9ea2('0x31')](_0x200d59['query'][_0x9ea2('0x31')]);_0x3333b9['offset']=qs[_0x9ea2('0x2f')](_0x200d59[_0x9ea2('0x47')][_0x9ea2('0x2f')]);}_0x3333b9['order']=qs[_0x9ea2('0x4f')](_0x200d59[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x3333b9[_0x9ea2('0x50')]=qs[_0x9ea2('0x51')](_[_0x9ea2('0x52')](_0x200d59[_0x9ea2('0x47')],_0x2039ba[_0x9ea2('0x51')]));_0x3333b9[_0x9ea2('0x50')]['FaxAccountId']=_0x2c6696['id'];if(_0x200d59[_0x9ea2('0x47')][_0x9ea2('0x54')]){_0x3333b9[_0x9ea2('0x50')]=_['merge'](_0x3333b9[_0x9ea2('0x50')],{'$or':_[_0x9ea2('0x46')](_0x3333b9[_0x9ea2('0x49')],function(_0x285cc6){var _0x1f9955={};_0x1f9955[_0x285cc6]={'$like':'%'+_0x200d59[_0x9ea2('0x47')]['filter']+'%'};return _0x1f9955;})});}_0x3333b9=_[_0x9ea2('0x53')]({},_0x3333b9,_0x200d59['options']);return db['Disposition'][_0x9ea2('0x32')]({'where':_0x3333b9['where']})[_0x9ea2('0x38')](function(_0x2e926e){_0x24f517[_0x9ea2('0x32')]=_0x2e926e;if(_0x200d59[_0x9ea2('0x47')]['includeAll']){_0x3333b9['include']=[{'all':!![]}];}return db[_0x9ea2('0x6c')][_0x9ea2('0x58')](_0x3333b9);})[_0x9ea2('0x38')](function(_0x5d4b28){_0x24f517[_0x9ea2('0x59')]=_0x5d4b28;return _0x24f517;});}})[_0x9ea2('0x38')](respondWithFilteredResult(_0x2ae061,_0x3333b9))[_0x9ea2('0x2b')](handleError(_0x2ae061,null));};exports[_0x9ea2('0x70')]=function(_0x1346c2,_0x2b92f2,_0x22148d){return db[_0x9ea2('0x43')][_0x9ea2('0x5e')]({'where':{'id':_0x1346c2[_0x9ea2('0x5b')]['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x2b92f2,null))[_0x9ea2('0x38')](function(_0xde7b46){if(_0xde7b46){return _0xde7b46[_0x9ea2('0x70')](_0x1346c2[_0x9ea2('0x47')][_0x9ea2('0x71')]);}})['then'](respondWithStatusCode(_0x2b92f2,null))[_0x9ea2('0x2b')](handleError(_0x2b92f2,null));};exports[_0x9ea2('0x72')]=function(_0x18540d,_0x5643e1,_0x3b880e){if(_0x18540d[_0x9ea2('0x60')]['id']){delete _0x18540d[_0x9ea2('0x60')]['id'];}return db['FaxAccount'][_0x9ea2('0x5e')]({'where':{'id':_0x18540d[_0x9ea2('0x5b')]['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x5643e1,null))[_0x9ea2('0x38')](function(_0x5c80a4){if(_0x5c80a4){_0x18540d['body'][_0x9ea2('0x6b')]=_0x5c80a4['id'];return db[_0x9ea2('0x73')]['create'](_0x18540d[_0x9ea2('0x60')]);}})[_0x9ea2('0x38')](respondWithResult(_0x5643e1,null))[_0x9ea2('0x2b')](handleError(_0x5643e1,null));};exports[_0x9ea2('0x74')]=function(_0x7bdbb5,_0x3c2cff,_0x44b2b0){var _0x12fae4={'raw':![],'where':{}};var _0x4e3cf2={};var _0x6ec025={'count':0x0,'rows':[]};return db[_0x9ea2('0x43')]['findOne']({'where':{'id':_0x7bdbb5['params']['id']}})['then'](handleEntityNotFound(_0x3c2cff,null))[_0x9ea2('0x38')](function(_0x49aae5){if(_0x49aae5){_0x4e3cf2[_0x9ea2('0x48')]=_[_0x9ea2('0x5d')](db['CannedAnswer']['rawAttributes']);_0x4e3cf2[_0x9ea2('0x47')]=_[_0x9ea2('0x5d')](_0x7bdbb5[_0x9ea2('0x47')]);_0x4e3cf2[_0x9ea2('0x51')]=_['intersection'](_0x4e3cf2[_0x9ea2('0x48')],_0x4e3cf2[_0x9ea2('0x47')]);_0x12fae4[_0x9ea2('0x49')]=_[_0x9ea2('0x4a')](_0x4e3cf2['model'],qs[_0x9ea2('0x4b')](_0x7bdbb5[_0x9ea2('0x47')][_0x9ea2('0x4b')]));_0x12fae4[_0x9ea2('0x49')]=_0x12fae4[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x12fae4['attributes']:_0x4e3cf2[_0x9ea2('0x48')];if(!_0x7bdbb5['query'][_0x9ea2('0x6f')](_0x9ea2('0x4d'))){_0x12fae4['limit']=qs['limit'](_0x7bdbb5['query']['limit']);_0x12fae4[_0x9ea2('0x2f')]=qs[_0x9ea2('0x2f')](_0x7bdbb5[_0x9ea2('0x47')][_0x9ea2('0x2f')]);}_0x12fae4[_0x9ea2('0x4e')]=qs[_0x9ea2('0x4f')](_0x7bdbb5[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x12fae4[_0x9ea2('0x50')]=qs[_0x9ea2('0x51')](_[_0x9ea2('0x52')](_0x7bdbb5[_0x9ea2('0x47')],_0x4e3cf2[_0x9ea2('0x51')]));_0x12fae4[_0x9ea2('0x50')][_0x9ea2('0x6b')]=_0x49aae5['id'];if(_0x7bdbb5[_0x9ea2('0x47')][_0x9ea2('0x54')]){_0x12fae4[_0x9ea2('0x50')]=_[_0x9ea2('0x53')](_0x12fae4[_0x9ea2('0x50')],{'$or':_['map'](_0x12fae4[_0x9ea2('0x49')],function(_0x1a52a3){var _0x5cf0c3={};_0x5cf0c3[_0x1a52a3]={'$like':'%'+_0x7bdbb5['query'][_0x9ea2('0x54')]+'%'};return _0x5cf0c3;})});}_0x12fae4=_[_0x9ea2('0x53')]({},_0x12fae4,_0x7bdbb5[_0x9ea2('0x55')]);return db[_0x9ea2('0x73')][_0x9ea2('0x32')]({'where':_0x12fae4[_0x9ea2('0x50')]})['then'](function(_0x574a10){_0x6ec025[_0x9ea2('0x32')]=_0x574a10;if(_0x7bdbb5[_0x9ea2('0x47')]['includeAll']){_0x12fae4[_0x9ea2('0x57')]=[{'all':!![]}];}return db[_0x9ea2('0x73')][_0x9ea2('0x58')](_0x12fae4);})[_0x9ea2('0x38')](function(_0x49f965){_0x6ec025[_0x9ea2('0x59')]=_0x49f965;return _0x6ec025;});}})[_0x9ea2('0x38')](respondWithFilteredResult(_0x3c2cff,_0x12fae4))['catch'](handleError(_0x3c2cff,null));};exports['removeAnswers']=function(_0x3aedbb,_0x1b3904,_0x12575f){return db[_0x9ea2('0x43')]['find']({'where':{'id':_0x3aedbb['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x1b3904,null))[_0x9ea2('0x38')](function(_0x557704){if(_0x557704){return _0x557704[_0x9ea2('0x75')](_0x3aedbb['query'][_0x9ea2('0x71')]);}})[_0x9ea2('0x38')](respondWithStatusCode(_0x1b3904,null))['catch'](handleError(_0x1b3904,null));};exports[_0x9ea2('0x76')]=function(_0x3beb42,_0x22ebe6,_0x1a9f44){return db[_0x9ea2('0x77')][_0x9ea2('0x5e')]({'where':{'id':_0x3beb42[_0x9ea2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x22ebe6,null))[_0x9ea2('0x38')](function(_0x309094){if(_0x309094){return _0x309094[_0x9ea2('0x76')](_0x3beb42['body'][_0x9ea2('0x71')],_[_0x9ea2('0x78')](_0x3beb42[_0x9ea2('0x60')],[_0x9ea2('0x71'),'id'])||{});}})[_0x9ea2('0x38')](respondWithResult(_0x22ebe6,null))[_0x9ea2('0x2b')](handleError(_0x22ebe6,null));};exports['getInteractions']=function(_0x3ef466,_0x99304c,_0x2eaff5){var _0x29f947={'raw':![],'where':{}};var _0x27ba65={};var _0x3675aa={'count':0x0,'rows':[]};return db[_0x9ea2('0x43')][_0x9ea2('0x6e')]({'where':{'id':_0x3ef466['params']['id']}})['then'](handleEntityNotFound(_0x99304c,null))[_0x9ea2('0x38')](function(_0x486b9c){if(_0x486b9c){_0x27ba65[_0x9ea2('0x48')]=_[_0x9ea2('0x5d')](db[_0x9ea2('0x77')][_0x9ea2('0x5c')]);_0x27ba65[_0x9ea2('0x47')]=_[_0x9ea2('0x5d')](_0x3ef466[_0x9ea2('0x47')]);_0x27ba65[_0x9ea2('0x51')]=_[_0x9ea2('0x4a')](_0x27ba65[_0x9ea2('0x48')],_0x27ba65['query']);_0x29f947['attributes']=_[_0x9ea2('0x4a')](_0x27ba65[_0x9ea2('0x48')],qs[_0x9ea2('0x4b')](_0x3ef466[_0x9ea2('0x47')]['fields']));_0x29f947[_0x9ea2('0x49')]=_0x29f947[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x29f947[_0x9ea2('0x49')]:_0x27ba65['model'];if(!_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x6f')]('nolimit')){_0x29f947[_0x9ea2('0x31')]=qs[_0x9ea2('0x31')](_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x31')]);_0x29f947['offset']=qs[_0x9ea2('0x2f')](_0x3ef466[_0x9ea2('0x47')]['offset']);}_0x29f947[_0x9ea2('0x4e')]=qs[_0x9ea2('0x4f')](_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x29f947[_0x9ea2('0x50')]=qs['filters'](_['pick'](_0x3ef466[_0x9ea2('0x47')],_0x27ba65['filters']));_0x29f947[_0x9ea2('0x50')][_0x9ea2('0x6b')]=_0x486b9c['id'];if(_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x54')]){_0x29f947[_0x9ea2('0x50')]=_[_0x9ea2('0x53')](_0x29f947[_0x9ea2('0x50')],{'$or':_['map'](_0x29f947['attributes'],function(_0xf8c456){var _0x58977={};_0x58977[_0xf8c456]={'$like':'%'+_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x54')]+'%'};return _0x58977;})});}_0x29f947=_['merge']({},_0x29f947,_0x3ef466['options']);return db[_0x9ea2('0x77')][_0x9ea2('0x32')]({'where':_0x29f947[_0x9ea2('0x50')]})[_0x9ea2('0x38')](function(_0x3c0fd5){_0x3675aa[_0x9ea2('0x32')]=_0x3c0fd5;if(_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x56')]){_0x29f947[_0x9ea2('0x57')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x9ea2('0x79')],'as':_0x9ea2('0x7a'),'attributes':['name',_0x9ea2('0x7b'),_0x9ea2('0x7c')],'required':![]},{'model':db[_0x9ea2('0x7d')],'as':_0x9ea2('0x7e'),'attributes':['id',_0x9ea2('0x3e'),_0x9ea2('0x7f')],'where':_0x3ef466[_0x9ea2('0x47')][_0x9ea2('0x80')]?{'id':_0x3ef466[_0x9ea2('0x47')]['tag']}:undefined,'required':_0x3ef466['query'][_0x9ea2('0x80')]?!![]:![]}];}return db[_0x9ea2('0x77')][_0x9ea2('0x58')](_0x29f947);})[_0x9ea2('0x38')](function(_0x25f297){_0x3675aa[_0x9ea2('0x59')]=_0x25f297;return _0x3675aa;});}})[_0x9ea2('0x38')](respondWithFilteredResult(_0x99304c,_0x29f947))[_0x9ea2('0x2b')](handleError(_0x99304c,null));};exports[_0x9ea2('0x81')]=function(_0x5e79f2,_0x3cb70e){var _0x205c7a=_0x5e79f2[_0x9ea2('0x5b')]['id'];var _0x55effb=_0x5e79f2[_0x9ea2('0x60')];var _0xf835c4=0xc8;var _0x22e671=null;return db[_0x9ea2('0x82')]['transaction']({'isolationLevel':db[_0x9ea2('0x82')][_0x9ea2('0x83')][_0x9ea2('0x84')][_0x9ea2('0x85')]},function(_0x1c1749){return db['FaxAccount']['findOne']({'where':{'id':_0x205c7a},'transaction':_0x1c1749})[_0x9ea2('0x38')](function(_0x483fed){if(_0x483fed){return db['FaxApplication'][_0x9ea2('0x39')]({'where':{'FaxAccountId':_0x205c7a},'transaction':_0x1c1749})[_0x9ea2('0x38')](function(){var _0x6197d4=_[_0x9ea2('0x46')](_0x55effb,function(_0xad8c78){_0xad8c78[_0x9ea2('0x6b')]=_0x205c7a;return _0xad8c78;});return db['FaxApplication'][_0x9ea2('0x86')](_0x6197d4,{'transaction':_0x1c1749});});}else{_0xf835c4=0x194;_0x22e671=[];}});})['then'](function(){if(_0xf835c4!==0x194){return db[_0x9ea2('0x87')]['findAndCountAll']({'where':{'FaxAccountId':_0x205c7a},'order':_0x9ea2('0x88')})['then'](function(_0x14bd59){_0x22e671=_0x14bd59;});}})[_0x9ea2('0x2b')](function(_0x3ceeb6){_0xf835c4=0x1f4;logger[_0x9ea2('0x27')](_0x3ceeb6[_0x9ea2('0x3d')]);if(_0x3ceeb6['name']){delete _0x3ceeb6[_0x9ea2('0x3e')];}_0x22e671=_0x3ceeb6;})[_0x9ea2('0x89')](function(){if(_0x22e671===null){_0x3cb70e[_0x9ea2('0x3c')](_0xf835c4);}else{if(_0xf835c4===0x1f4){_0x3cb70e[_0x9ea2('0x2c')](_0xf835c4)[_0x9ea2('0x3f')](_0x22e671);}else{_0x3cb70e[_0x9ea2('0x2c')](_0xf835c4)['json'](_0x22e671);}}});};exports[_0x9ea2('0x8a')]=function(_0x1d924a,_0x76a550,_0x4fc877){var _0x3d25e9={};var _0x825188={};var _0x157be0;var _0x308768;return db['FaxAccount'][_0x9ea2('0x6e')]({'where':{'id':_0x1d924a['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x76a550,null))[_0x9ea2('0x38')](function(_0x52ca79){if(_0x52ca79){_0x157be0=_0x52ca79;_0x825188[_0x9ea2('0x48')]=_[_0x9ea2('0x5d')](db['FaxApplication'][_0x9ea2('0x5c')]);_0x825188[_0x9ea2('0x47')]=_['keys'](_0x1d924a[_0x9ea2('0x47')]);_0x825188['filters']=_[_0x9ea2('0x4a')](_0x825188[_0x9ea2('0x48')],_0x825188[_0x9ea2('0x47')]);_0x3d25e9[_0x9ea2('0x49')]=_[_0x9ea2('0x4a')](_0x825188['model'],qs[_0x9ea2('0x4b')](_0x1d924a[_0x9ea2('0x47')]['fields']));_0x3d25e9[_0x9ea2('0x49')]=_0x3d25e9[_0x9ea2('0x49')]['length']?_0x3d25e9[_0x9ea2('0x49')]:_0x825188[_0x9ea2('0x48')];_0x3d25e9['order']=qs[_0x9ea2('0x4f')](_0x1d924a[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x3d25e9[_0x9ea2('0x50')]=qs[_0x9ea2('0x51')](_[_0x9ea2('0x52')](_0x1d924a[_0x9ea2('0x47')],_0x825188[_0x9ea2('0x51')]));if(_0x1d924a[_0x9ea2('0x47')]['filter']){_0x3d25e9[_0x9ea2('0x50')]=_[_0x9ea2('0x53')](_0x3d25e9['where'],{'$or':_[_0x9ea2('0x46')](_0x3d25e9[_0x9ea2('0x49')],function(_0x2e8acb){var _0x257acb={};_0x257acb[_0x2e8acb]={'$like':'%'+_0x1d924a[_0x9ea2('0x47')][_0x9ea2('0x54')]+'%'};return _0x257acb;})});}_0x3d25e9=_[_0x9ea2('0x53')]({},_0x3d25e9,_0x1d924a[_0x9ea2('0x55')]);return _0x157be0[_0x9ea2('0x8a')](_0x3d25e9);}})[_0x9ea2('0x38')](function(_0x3cab2c){if(_0x3cab2c){_0x308768=_0x3cab2c[_0x9ea2('0x4c')];if(!_0x1d924a[_0x9ea2('0x47')]['hasOwnProperty'](_0x9ea2('0x4d'))){_0x3d25e9[_0x9ea2('0x31')]=qs['limit'](_0x1d924a['query'][_0x9ea2('0x31')]);_0x3d25e9[_0x9ea2('0x2f')]=qs[_0x9ea2('0x2f')](_0x1d924a[_0x9ea2('0x47')][_0x9ea2('0x2f')]);}return _0x157be0[_0x9ea2('0x8a')](_0x3d25e9);}})['then'](function(_0x382f11){if(_0x382f11){return _0x382f11?{'count':_0x308768,'rows':_0x382f11}:null;}})['then'](respondWithResult(_0x76a550,null))[_0x9ea2('0x2b')](handleError(_0x76a550,null));};function Extension(_0x5a733d,_0x374fd2,_0x2f5c60,_0x4f3301){this['context']=_0x9ea2('0x8b');this[_0x9ea2('0x8c')]=_0x5a733d[_0x9ea2('0x8d')];this[_0x9ea2('0x8e')]=_0x4f3301;this['type']=_0x9ea2('0x8f');this['description']=_0x9ea2('0x90');this[_0x9ea2('0x6b')]=_0x5a733d['id'];this[_0x9ea2('0x88')]=_0x374fd2;this[_0x9ea2('0x91')]=_0x2f5c60;}function createExtensionsReciveFax(_0x38f74f){var _0x13fd84=0x1;var _0x34e4a4=[];_0x34e4a4[_0x9ea2('0x92')](new Extension(_0x38f74f,_0x13fd84,'',_0x9ea2('0x93')));_0x13fd84+=0x1;_0x34e4a4[_0x9ea2('0x92')](new Extension(_0x38f74f,_0x13fd84,_0x9ea2('0x94'),'Set'));_0x13fd84+=0x1;for(var _0x2eeab4 in _0x38f74f){if(_0x38f74f[_0x9ea2('0x6f')](_0x2eeab4)&&(_0x2eeab4==='ecm'||_0x2eeab4===_0x9ea2('0x8d')||_0x2eeab4===_0x9ea2('0x95')||_0x2eeab4===_0x9ea2('0x96')||_0x2eeab4===_0x9ea2('0x97')||_0x2eeab4===_0x9ea2('0x98')||_0x2eeab4===_0x9ea2('0x99')||_0x2eeab4===_0x9ea2('0x9a')||_0x2eeab4===_0x9ea2('0x9b'))){_0x34e4a4[_0x9ea2('0x92')](new Extension(_0x38f74f,_0x13fd84,_0x9ea2('0x9c')+_0x2eeab4+')='+_0x38f74f[_0x2eeab4],_0x9ea2('0x9d')));_0x13fd84+=0x1;}}_0x34e4a4[_0x9ea2('0x92')](new Extension(_0x38f74f,_0x13fd84,'6',_0x9ea2('0x9e')));_0x13fd84+=0x1;_0x34e4a4[_0x9ea2('0x92')](new Extension(_0x38f74f,_0x13fd84,_0x9ea2('0x9f'),_0x9ea2('0xa0')));_0x13fd84=0x0;return _0x34e4a4;}exports[_0x9ea2('0xa1')]=function(_0x14ba7a,_0x47ff6b,_0x2701c3){var _0x4d5318;return db[_0x9ea2('0x82')]['transaction'](function(_0x2b92cf){return db[_0x9ea2('0x43')][_0x9ea2('0x5f')](_0x14ba7a[_0x9ea2('0x60')],{'transaction':_0x2b92cf})['then'](function(_0x4716f9){_0x4d5318=_0x4716f9[_0x9ea2('0x64')]({'plain':!![]});return db[_0x9ea2('0xa2')]['bulkCreate'](createExtensionsReciveFax(_0x4d5318),{'transaction':_0x2b92cf});});})[_0x9ea2('0x38')](function(){return _0x4d5318;})[_0x9ea2('0x38')](respondWithResult(_0x47ff6b,null))[_0x9ea2('0x2b')](handleError(_0x47ff6b,null));};exports[_0x9ea2('0xa3')]=function(_0xe5a30a,_0x30f8ea,_0x4b6396){var _0x2fa701;return db[_0x9ea2('0x82')]['transaction'](function(_0x1a8c7b){return db[_0x9ea2('0x43')][_0x9ea2('0x37')](_0xe5a30a['body'],{'where':{'id':_0xe5a30a[_0x9ea2('0x60')]['id']},'transaction':_0x1a8c7b})[_0x9ea2('0x38')](function(_0x1dc66a){return db[_0x9ea2('0xa2')][_0x9ea2('0x39')]({'where':{'FaxAccountId':_0xe5a30a['body']['id']},'transaction':_0x1a8c7b})['then'](function(_0x54c751){return db[_0x9ea2('0xa2')][_0x9ea2('0x86')](createExtensionsReciveFax(_[_0x9ea2('0x78')](_0xe5a30a['body'],['tech',_0x9ea2('0x45'),'createdAt','updatedAt',_0x9ea2('0xa4'),'ListId'])),{'transaction':_0x1a8c7b});});});})['then'](function(){return db[_0x9ea2('0x43')]['findById'](_0xe5a30a[_0x9ea2('0x60')]['id']);})['then'](respondWithResult(_0x30f8ea,null))['catch'](handleError(_0x30f8ea,null));};exports[_0x9ea2('0xa5')]=function(_0x38b89c,_0x51ea74,_0x2d7cfe){var _0x4dbab7={'raw':!![],'where':{}};var _0x496a5f={};var _0x33e1fe={'count':0x0,'rows':[]};return db[_0x9ea2('0x43')][_0x9ea2('0x6e')]({'where':{'id':_0x38b89c['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x51ea74,null))[_0x9ea2('0x38')](function(_0x57506a){if(_0x57506a){_0x496a5f[_0x9ea2('0x48')]=_[_0x9ea2('0x5d')](db['FaxMessage'][_0x9ea2('0x5c')]);_0x496a5f[_0x9ea2('0x47')]=_['keys'](_0x38b89c[_0x9ea2('0x47')]);_0x496a5f[_0x9ea2('0x51')]=_['intersection'](_0x496a5f['model'],_0x496a5f[_0x9ea2('0x47')]);_0x4dbab7[_0x9ea2('0x49')]=_[_0x9ea2('0x4a')](_0x496a5f[_0x9ea2('0x48')],qs[_0x9ea2('0x4b')](_0x38b89c[_0x9ea2('0x47')]['fields']));_0x4dbab7[_0x9ea2('0x49')]=_0x4dbab7[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x4dbab7[_0x9ea2('0x49')]:_0x496a5f[_0x9ea2('0x48')];if(!_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0x6f')](_0x9ea2('0x4d'))){_0x4dbab7[_0x9ea2('0x31')]=qs[_0x9ea2('0x31')](_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0x31')]);_0x4dbab7[_0x9ea2('0x2f')]=qs[_0x9ea2('0x2f')](_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0x2f')]);}_0x4dbab7[_0x9ea2('0x4e')]=qs['sort'](_0x38b89c[_0x9ea2('0x47')]['sort']);_0x4dbab7[_0x9ea2('0x50')]=qs['filters'](_[_0x9ea2('0x52')](_0x38b89c['query'],_0x496a5f[_0x9ea2('0x51')]));_0x4dbab7['where']['FaxAccountId']=_0x57506a['id'];if(_0x38b89c['query'][_0x9ea2('0x54')]){_0x4dbab7['where']=_[_0x9ea2('0x53')](_0x4dbab7[_0x9ea2('0x50')],{'$or':_['map'](_0x4dbab7[_0x9ea2('0x49')],function(_0x4eb1c7){var _0x50b102={};_0x50b102[_0x4eb1c7]={'$like':'%'+_0x38b89c[_0x9ea2('0x47')]['filter']+'%'};return _0x50b102;})});}if(_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0xa6')]){var _0x4a7f07=_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0xa6')]['split'](',');var _0x5c9f56={};_0x5c9f56[_0x4a7f07[0x0]]={'$gte':moment(_0x4a7f07[0x1])[_0x9ea2('0xa7')](_0x9ea2('0xa8'))};_0x4dbab7[_0x9ea2('0x50')]=_['merge'](_0x4dbab7[_0x9ea2('0x50')],_0x5c9f56);}_0x4dbab7=_[_0x9ea2('0x53')]({},_0x4dbab7,_0x38b89c[_0x9ea2('0x55')]);return db[_0x9ea2('0xa9')][_0x9ea2('0x32')]({'where':_0x4dbab7[_0x9ea2('0x50')]})[_0x9ea2('0x38')](function(_0x143abd){_0x33e1fe[_0x9ea2('0x32')]=_0x143abd;if(_0x38b89c[_0x9ea2('0x47')][_0x9ea2('0x56')]){_0x4dbab7[_0x9ea2('0x57')]=[{'all':!![]}];}return db[_0x9ea2('0xa9')][_0x9ea2('0x58')](_0x4dbab7);})[_0x9ea2('0x38')](function(_0x42da60){_0x33e1fe['rows']=_0x42da60;return _0x33e1fe;});}})['then'](respondWithFilteredResult(_0x51ea74,_0x4dbab7))[_0x9ea2('0x2b')](handleError(_0x51ea74,null));};exports[_0x9ea2('0x3f')]=function(_0x4a8f3a,_0xd27033,_0x6a42da){var _0xe9aff7,_0x5d0109={},_0x43187b;if(_0x4a8f3a[_0x9ea2('0x60')]['to']){_0x43187b=_0x4a8f3a['body']['to'][0x0];}return db[_0x9ea2('0x43')][_0x9ea2('0x5e')]({'where':{'id':_0x4a8f3a[_0x9ea2('0x5b')]['id']},'include':[{'model':db[_0x9ea2('0xaa')],'as':_0x9ea2('0xab'),'include':[{'model':db['CmContact'],'as':_0x9ea2('0xac'),'where':{'fax':_0x43187b},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x9ea2('0x38')](handleEntityNotFound(_0xd27033,null))[_0x9ea2('0x38')](function(_0x43d14a){_0xe9aff7=_0x43d14a;if(_0x4a8f3a['body'][_0x9ea2('0xad')]&&_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][_0x9ea2('0x4c')]){for(var _0x215111=0x0;_0x215111<_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][_0x9ea2('0x4c')];_0x215111+=0x1){_0x4a8f3a['body'][_0x9ea2('0xad')][_0x215111]={'filename':_0x4a8f3a['body'][_0x9ea2('0xad')][_0x215111][_0x9ea2('0x3e')],'id':_0x4a8f3a[_0x9ea2('0x60')]['attachments'][_0x215111]['id'],'path':path[_0x9ea2('0xae')](config[_0x9ea2('0xaf')],'server/files/attachments',_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][_0x215111][_0x9ea2('0xb0')])};}}return respondWithRpcPromise(_0x9ea2('0xb1'),_0x9ea2('0xb1'),{'FaxAccountId':_[_0x9ea2('0xb2')](_0x4a8f3a[_0x9ea2('0x5b')]['id'])?undefined:_0x4a8f3a[_0x9ea2('0x5b')]['id'],'path':_[_0x9ea2('0xb2')](_0x4a8f3a[_0x9ea2('0x60')]['attachments'][0x0][_0x9ea2('0xb3')])?undefined:_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][0x0][_0x9ea2('0xb3')],'fax':_[_0x9ea2('0xb2')](_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0])?undefined:_0x4a8f3a['body']['to'][0x0]},client9002);})[_0x9ea2('0x38')](function(){if(_0xe9aff7){if(_['isNil'](_0x4a8f3a[_0x9ea2('0x60')]['from'])){_0x4a8f3a['body'][_0x9ea2('0xb4')]=util[_0x9ea2('0xa7')](_0x9ea2('0xb5'),_0xe9aff7[_0x9ea2('0x3e')],_0xe9aff7[_0x9ea2('0xb6')]);}if(_0xe9aff7[_0x9ea2('0xab')]){if(_0xe9aff7[_0x9ea2('0xab')][_0x9ea2('0xac')]['length']){return _0xe9aff7[_0x9ea2('0xab')][_0x9ea2('0xac')][0x0];}else{return db[_0x9ea2('0xb7')][_0x9ea2('0x5f')](_[_0x9ea2('0x1a')](_0x4a8f3a[_0x9ea2('0x60')],{'firstName':_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0],'phone':_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0],'fax':_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0],'ListId':_0xe9aff7[_0x9ea2('0xb8')]}));}}else{throw new Error(_0x9ea2('0xb9'));}}else{throw new Error(_0x9ea2('0xba'));}})[_0x9ea2('0x38')](function(_0x2ba120){if(_0x2ba120){return db[_0x9ea2('0x77')][_0x9ea2('0x5e')]({'where':{'ContactId':_0x2ba120['id'],'closed':![],'FaxAccountId':_0xe9aff7['id']}})['then'](function(_0x46a3f7){if(_0x46a3f7){return[_0x46a3f7,![]];}return db['FaxInteraction'][_0x9ea2('0x5f')]({'UserId':_0x4a8f3a[_0x9ea2('0x61')]['id'],'ContactId':_0x2ba120['id'],'FaxAccountId':_0xe9aff7['id'],'fax':_0x4a8f3a['body']['to'][0x0],'firstMsgDirection':_0x9ea2('0xbb'),'Messages':[_[_0x9ea2('0x53')](_0x4a8f3a[_0x9ea2('0x60')],{'read':![],'body':_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][0x0]['filename'],'FaxAccountId':_0xe9aff7['id'],'UserId':_0x4a8f3a[_0x9ea2('0x61')]['id'],'ContactId':_0x2ba120['id'],'AttachmentId':_0x4a8f3a['body'][_0x9ea2('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x9ea2('0xa9')],'as':_0x9ea2('0xbc')}]})[_0x9ea2('0x38')](function(_0x2b9e82){return[_0x2b9e82,!![]];});});}else{throw new Error(_0x9ea2('0xbd'));}})[_0x9ea2('0xbe')](function(_0x3f3b9a,_0x2ebfed){if(_0x2ebfed){return _0x3f3b9a;}return db[_0x9ea2('0xa9')]['create']({'direction':_0x9ea2('0xbb'),'read':![],'body':_0x4a8f3a['body']['attachments'][0x0][_0x9ea2('0xbf')],'FaxAccountId':_0xe9aff7['id'],'FaxInteractionId':_0x3f3b9a['id'],'UserId':_0x4a8f3a[_0x9ea2('0x61')]['id'],'ContactId':_0x3f3b9a['ContactId'],'AttachmentId':_0x4a8f3a[_0x9ea2('0x60')][_0x9ea2('0xad')][0x0]['id']})[_0x9ea2('0x38')](function(_0x53ff23){_0x3f3b9a[_0x9ea2('0xc0')][_0x9ea2('0xbc')]=[];_0x3f3b9a[_0x9ea2('0xc0')]['Messages'][_0x9ea2('0x92')](_0x53ff23['dataValues']);return _0x3f3b9a;});})[_0x9ea2('0x38')](function(_0x4f5d0c){respondWithRpcPromise(_0x9ea2('0xc1'),_0x9ea2('0xc1'),{'FaxAccountId':_[_0x9ea2('0xb2')](_0x4a8f3a[_0x9ea2('0x5b')]['id'])?undefined:_0x4a8f3a['params']['id'],'path':_[_0x9ea2('0xb2')](_0x4a8f3a['body'][_0x9ea2('0xad')][0x0][_0x9ea2('0xb3')])?undefined:_0x4a8f3a['body'][_0x9ea2('0xad')][0x0][_0x9ea2('0xb3')],'fax':_[_0x9ea2('0xb2')](_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0])?undefined:_0x4a8f3a[_0x9ea2('0x60')]['to'][0x0],'AttachmentId':_0x4a8f3a[_0x9ea2('0x60')]['attachments'][0x0]['id']},client9002)['then'](function(_0x131012){logger[_0x9ea2('0x22')]('SendFaxRpc,\x20%s',_0x131012);})['catch'](function(_0x2bbe67){logger[_0x9ea2('0x22')](_0x9ea2('0xc2'),_0x2bbe67);});return _0x4f5d0c;})[_0x9ea2('0x38')](respondWithResult(_0xd27033,null))['catch'](handleError(_0xd27033,null));};exports['addAgents']=function(_0x16a584,_0x52cf68,_0x5b6799){return db['FaxAccount']['find']({'where':{'id':_0x16a584['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x52cf68,null))['then'](function(_0x5265ba){if(_0x5265ba){return _0x5265ba[_0x9ea2('0xc3')](_0x16a584['body'][_0x9ea2('0x71')],_[_0x9ea2('0x78')](_0x16a584[_0x9ea2('0x60')],[_0x9ea2('0x71'),'id'])||{})[_0x9ea2('0xbe')](function(_0x280d7e){for(var _0x87831=0x0;_0x87831<_0x16a584[_0x9ea2('0x60')][_0x9ea2('0x71')]['length'];_0x87831+=0x1){socket['emit'](_0x9ea2('0xc4'),{'UserId':Number(_0x16a584[_0x9ea2('0x60')]['ids'][_0x87831]),'FaxAccountId':Number(_0x16a584[_0x9ea2('0x5b')]['id'])});}return _0x280d7e;});}})[_0x9ea2('0x38')](respondWithResult(_0x52cf68,null))['catch'](handleError(_0x52cf68,null));};exports[_0x9ea2('0xc5')]=function(_0x3ca842,_0x1dad9f,_0x345f91){return db[_0x9ea2('0x43')]['find']({'where':{'id':_0x3ca842['params']['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x1dad9f,null))['then'](function(_0x10b659){if(_0x10b659){return _0x10b659[_0x9ea2('0xc5')](_0x3ca842['query'][_0x9ea2('0x71')])[_0x9ea2('0x38')](function(){if(_['isArray'](_0x3ca842[_0x9ea2('0x47')][_0x9ea2('0x71')])){for(var _0x32a774=0x0;_0x32a774<_0x3ca842[_0x9ea2('0x47')][_0x9ea2('0x71')][_0x9ea2('0x4c')];_0x32a774+=0x1){socket[_0x9ea2('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x3ca842[_0x9ea2('0x47')][_0x9ea2('0x71')][_0x32a774]),'FaxAccountId':Number(_0x3ca842[_0x9ea2('0x5b')]['id'])});}}else{socket[_0x9ea2('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x3ca842['query'][_0x9ea2('0x71')]),'FaxAccountId':Number(_0x3ca842['params']['id'])});}});}})[_0x9ea2('0x38')](respondWithStatusCode(_0x1dad9f,null))[_0x9ea2('0x2b')](handleError(_0x1dad9f,null));};exports[_0x9ea2('0xc7')]=function(_0x1fb5eb,_0x52c50b,_0x371cd1){var _0x567bcc={};var _0x1aa9dd={};var _0x24125c;var _0xfa20ba;return db[_0x9ea2('0x43')][_0x9ea2('0x6e')]({'where':{'id':_0x1fb5eb[_0x9ea2('0x5b')]['id']}})[_0x9ea2('0x38')](handleEntityNotFound(_0x52c50b,null))['then'](function(_0x340ff2){if(_0x340ff2){_0x24125c=_0x340ff2;_0x1aa9dd['model']=_[_0x9ea2('0x5d')](db['User'][_0x9ea2('0x5c')]);_0x1aa9dd[_0x9ea2('0x47')]=_['keys'](_0x1fb5eb['query']);_0x1aa9dd['filters']=_['intersection'](_0x1aa9dd[_0x9ea2('0x48')],_0x1aa9dd[_0x9ea2('0x47')]);_0x567bcc[_0x9ea2('0x49')]=_['intersection'](_0x1aa9dd[_0x9ea2('0x48')],qs['fields'](_0x1fb5eb[_0x9ea2('0x47')][_0x9ea2('0x4b')]));_0x567bcc[_0x9ea2('0x49')]=_0x567bcc[_0x9ea2('0x49')][_0x9ea2('0x4c')]?_0x567bcc['attributes']:_0x1aa9dd[_0x9ea2('0x48')];_0x567bcc['order']=qs['sort'](_0x1fb5eb[_0x9ea2('0x47')][_0x9ea2('0x4f')]);_0x567bcc['where']=qs[_0x9ea2('0x51')](_[_0x9ea2('0x52')](_0x1fb5eb[_0x9ea2('0x47')],_0x1aa9dd[_0x9ea2('0x51')]));if(_0x1fb5eb['query'][_0x9ea2('0x54')]){_0x567bcc['where']=_[_0x9ea2('0x53')](_0x567bcc[_0x9ea2('0x50')],{'$or':_[_0x9ea2('0x46')](_0x567bcc[_0x9ea2('0x49')],function(_0x484ade){var _0x2a9977={};_0x2a9977[_0x484ade]={'$like':'%'+_0x1fb5eb[_0x9ea2('0x47')][_0x9ea2('0x54')]+'%'};return _0x2a9977;})});}_0x567bcc=_[_0x9ea2('0x53')]({},_0x567bcc,_0x1fb5eb[_0x9ea2('0x55')]);return _0x24125c[_0x9ea2('0xc7')](_0x567bcc);}})['then'](function(_0x584d79){if(_0x584d79){_0xfa20ba=_0x584d79['length'];if(!_0x1fb5eb[_0x9ea2('0x47')][_0x9ea2('0x6f')](_0x9ea2('0x4d'))){_0x567bcc[_0x9ea2('0x31')]=qs[_0x9ea2('0x31')](_0x1fb5eb['query']['limit']);_0x567bcc[_0x9ea2('0x2f')]=qs[_0x9ea2('0x2f')](_0x1fb5eb[_0x9ea2('0x47')]['offset']);}return _0x24125c[_0x9ea2('0xc7')](_0x567bcc);}})[_0x9ea2('0x38')](function(_0x56a1b7){if(_0x56a1b7){return _0x56a1b7?{'count':_0xfa20ba,'rows':_0x56a1b7}:null;}})[_0x9ea2('0x38')](respondWithResult(_0x52c50b,null))[_0x9ea2('0x2b')](handleError(_0x52c50b,null));};
\ No newline at end of file
+var _0xeba1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','keys','find','create','body','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','User','Owner','fullname','internal','color','tag','findAll','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','user','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x59b7ce,_0x2e0160){var _0x5c878a=function(_0x348342){while(--_0x348342){_0x59b7ce['push'](_0x59b7ce['shift']());}};_0x5c878a(++_0x2e0160);}(_0xeba1,0xb8));var _0x1eba=function(_0x3babbd,_0x540d72){_0x3babbd=_0x3babbd-0x0;var _0x5f3a22=_0xeba1[_0x3babbd];return _0x5f3a22;};'use strict';var emlformat=require(_0x1eba('0x0'));var rimraf=require(_0x1eba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1eba('0x2'));var rp=require(_0x1eba('0x3'));var moment=require(_0x1eba('0x4'));var BPromise=require(_0x1eba('0x5'));var Mustache=require(_0x1eba('0x6'));var util=require(_0x1eba('0x7'));var path=require(_0x1eba('0x8'));var sox=require('sox');var csv=require(_0x1eba('0x9'));var ejs=require(_0x1eba('0xa'));var fs=require('fs');var fs_extra=require(_0x1eba('0xb'));var _=require('lodash');var squel=require(_0x1eba('0xc'));var crypto=require(_0x1eba('0xd'));var jsforce=require(_0x1eba('0xe'));var deskjs=require(_0x1eba('0xf'));var toCsv=require(_0x1eba('0x9'));var querystring=require(_0x1eba('0x10'));var Papa=require(_0x1eba('0x11'));var Redis=require(_0x1eba('0x12'));var authService=require(_0x1eba('0x13'));var qs=require(_0x1eba('0x14'));var as=require(_0x1eba('0x15'));var hardwareService=require(_0x1eba('0x16'));var logger=require(_0x1eba('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x1eba('0x18'));var licenseUtil=require(_0x1eba('0x19'));var db=require(_0x1eba('0x1a'))['db'];config[_0x1eba('0x1b')]=_['defaults'](config['redis'],{'host':_0x1eba('0x1c'),'port':0x18eb});var socket=require(_0x1eba('0x1d'))(new Redis(config['redis']));require(_0x1eba('0x1e'))[_0x1eba('0x1f')](socket);var jayson=require(_0x1eba('0x20'));var client=jayson[_0x1eba('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x1eba('0x21')][_0x1eba('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2b7322,_0xd01682,_0x48abee,_0x2b564a){return new BPromise(function(_0x2b5559,_0x400de7){var _0x34cc61=_0x2b564a||client;return _0x34cc61['request'](_0x2b7322,_0x48abee)[_0x1eba('0x23')](function(_0x32a6f4){logger[_0x1eba('0x24')](_0x1eba('0x25'),_0xd01682,'request\x20sent');logger[_0x1eba('0x26')](_0x1eba('0x27'),_0xd01682,_0x1eba('0x28'),JSON[_0x1eba('0x29')](_0x32a6f4));if(_0x32a6f4[_0x1eba('0x2a')]){if(_0x32a6f4['error'][_0x1eba('0x2b')]===0x1f4){logger['error'](_0x1eba('0x25'),_0xd01682,_0x32a6f4[_0x1eba('0x2a')][_0x1eba('0x2c')]);return _0x400de7(_0x32a6f4[_0x1eba('0x2a')][_0x1eba('0x2c')]);}logger[_0x1eba('0x2a')](_0x1eba('0x25'),_0xd01682,_0x32a6f4['error'][_0x1eba('0x2c')]);return _0x2b5559(_0x32a6f4[_0x1eba('0x2a')]['message']);}else{logger[_0x1eba('0x24')](_0x1eba('0x25'),_0xd01682,_0x1eba('0x28'));_0x2b5559(_0x32a6f4[_0x1eba('0x2d')][_0x1eba('0x2c')]);}})[_0x1eba('0x2e')](function(_0x11cfa0){logger[_0x1eba('0x2a')]('FaxAccount,\x20%s,\x20%s',_0xd01682,_0x11cfa0);_0x400de7(_0x11cfa0);});});}function respondWithStatusCode(_0x413c19,_0x3ed813){_0x3ed813=_0x3ed813||0xcc;return function(_0x586b21){if(_0x586b21){return _0x413c19['sendStatus'](_0x3ed813);}return _0x413c19[_0x1eba('0x2f')](_0x3ed813)[_0x1eba('0x30')]();};}function respondWithResult(_0x20d1e0,_0x59b67f){_0x59b67f=_0x59b67f||0xc8;return function(_0xc4f6a8){if(_0xc4f6a8){return _0x20d1e0[_0x1eba('0x2f')](_0x59b67f)[_0x1eba('0x31')](_0xc4f6a8);}};}function respondWithFilteredResult(_0x109828,_0x4e5f6b){return function(_0x1049f5){if(_0x1049f5){var _0x4f6b34=typeof _0x4e5f6b[_0x1eba('0x32')]===_0x1eba('0x33')&&typeof _0x4e5f6b[_0x1eba('0x34')]===_0x1eba('0x33');var _0x14a69c=_0x1049f5[_0x1eba('0x35')];var _0x53c4f1=_0x4f6b34?0x0:_0x4e5f6b['offset'];var _0x1789ff=_0x4f6b34?_0x1049f5[_0x1eba('0x35')]:_0x4e5f6b[_0x1eba('0x32')]+_0x4e5f6b['limit'];var _0x1fa462;if(_0x1789ff>=_0x14a69c){_0x1789ff=_0x14a69c;_0x1fa462=0xc8;}else{_0x1fa462=0xce;}_0x109828[_0x1eba('0x2f')](_0x1fa462);return _0x109828['set'](_0x1eba('0x36'),_0x53c4f1+'-'+_0x1789ff+'/'+_0x14a69c)[_0x1eba('0x31')](_0x1049f5);}return null;};}function patchUpdates(_0x4493bb){return function(_0x56b2b3){try{jsonpatch[_0x1eba('0x37')](_0x56b2b3,_0x4493bb,!![]);}catch(_0xa7491){return BPromise['reject'](_0xa7491);}return _0x56b2b3[_0x1eba('0x38')]();};}function saveUpdates(_0x33162a,_0x3aa3fe){return function(_0xcfb82e){if(_0xcfb82e){return _0xcfb82e[_0x1eba('0x39')](_0x33162a)[_0x1eba('0x23')](function(_0x505142){return _0x505142;});}return null;};}function removeEntity(_0x55beda,_0x3e1abe){return function(_0x31f4bd){if(_0x31f4bd){return _0x31f4bd[_0x1eba('0x3a')]()['then'](function(){var _0x5a019e=_0x31f4bd[_0x1eba('0x3b')]({'plain':!![]});var _0x5f22c7=_0x1eba('0x3c');return db[_0x1eba('0x3d')]['destroy']({'where':{'type':_0x5f22c7,'resourceId':_0x5a019e['id']}})[_0x1eba('0x23')](function(){return _0x31f4bd;});})[_0x1eba('0x23')](function(){_0x55beda['status'](0xcc)[_0x1eba('0x30')]();});}};}function handleEntityNotFound(_0x1f0491,_0x428a36){return function(_0x3e588d){if(!_0x3e588d){_0x1f0491[_0x1eba('0x3e')](0x194);}return _0x3e588d;};}function handleError(_0x1f3729,_0x252c47){_0x252c47=_0x252c47||0x1f4;return function(_0x4e00dc){logger[_0x1eba('0x2a')](_0x4e00dc[_0x1eba('0x3f')]);if(_0x4e00dc[_0x1eba('0x40')]){delete _0x4e00dc[_0x1eba('0x40')];}_0x1f3729['status'](_0x252c47)[_0x1eba('0x41')](_0x4e00dc);};}exports[_0x1eba('0x42')]=function(_0xae58b7,_0x51da15){var _0xe8aed6={'include':[{'model':db[_0x1eba('0x43')],'as':_0x1eba('0x44')}]},_0x404205={},_0x231883={'count':0x0,'rows':[]};var _0x111c4c=_[_0x1eba('0x45')](db[_0x1eba('0x46')][_0x1eba('0x47')],function(_0x543e77){return{'name':_0x543e77[_0x1eba('0x48')],'type':_0x543e77[_0x1eba('0x49')][_0x1eba('0x4a')]};});_0x404205[_0x1eba('0x4b')]=_[_0x1eba('0x45')](_0x111c4c,'name');_0x404205[_0x1eba('0x4c')]=_['keys'](_0xae58b7[_0x1eba('0x4c')]);_0x404205[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x404205[_0x1eba('0x4b')],_0x404205[_0x1eba('0x4c')]);_0xe8aed6[_0x1eba('0x4f')]=_[_0x1eba('0x4e')](_0x404205[_0x1eba('0x4b')],qs[_0x1eba('0x50')](_0xae58b7[_0x1eba('0x4c')][_0x1eba('0x50')]));_0xe8aed6[_0x1eba('0x4f')]=_0xe8aed6[_0x1eba('0x4f')][_0x1eba('0x51')]?_0xe8aed6['attributes']:_0x404205[_0x1eba('0x4b')];if(!_0xae58b7[_0x1eba('0x4c')]['hasOwnProperty'](_0x1eba('0x52'))){_0xe8aed6[_0x1eba('0x34')]=qs[_0x1eba('0x34')](_0xae58b7[_0x1eba('0x4c')]['limit']);_0xe8aed6[_0x1eba('0x32')]=qs[_0x1eba('0x32')](_0xae58b7[_0x1eba('0x4c')][_0x1eba('0x32')]);}_0xe8aed6[_0x1eba('0x53')]=qs[_0x1eba('0x54')](_0xae58b7['query'][_0x1eba('0x54')]);_0xe8aed6[_0x1eba('0x55')]=qs[_0x1eba('0x4d')](_[_0x1eba('0x56')](_0xae58b7[_0x1eba('0x4c')],_0x404205[_0x1eba('0x4d')]),_0x111c4c);if(_0xae58b7[_0x1eba('0x4c')][_0x1eba('0x57')]){_0xe8aed6['where']=_[_0x1eba('0x58')](_0xe8aed6['where'],{'$or':_['map'](_0x111c4c,function(_0x22877a){if(_0x22877a[_0x1eba('0x49')]!=='VIRTUAL'){var _0x4e836f={};_0x4e836f[_0x22877a[_0x1eba('0x40')]]={'$like':'%'+_0xae58b7['query'][_0x1eba('0x57')]+'%'};return _0x4e836f;}})});}_0xe8aed6=_[_0x1eba('0x58')]({},_0xe8aed6,_0xae58b7[_0x1eba('0x59')]);var _0x2e768d={'where':_0xe8aed6['where']};return db[_0x1eba('0x46')][_0x1eba('0x35')](_0x2e768d)[_0x1eba('0x23')](function(_0x2b49c9){_0x231883[_0x1eba('0x35')]=_0x2b49c9;if(_0xae58b7[_0x1eba('0x4c')][_0x1eba('0x5a')]){_0xe8aed6[_0x1eba('0x5b')]=[{'all':!![]}];}return db[_0x1eba('0x46')]['findAll'](_0xe8aed6);})[_0x1eba('0x23')](function(_0x3f6cf0){_0x231883[_0x1eba('0x5c')]=_0x3f6cf0;return _0x231883;})[_0x1eba('0x23')](respondWithFilteredResult(_0x51da15,_0xe8aed6))[_0x1eba('0x2e')](handleError(_0x51da15,null));};exports[_0x1eba('0x5d')]=function(_0x2a4485,_0x59ea59){var _0x42934e={'raw':![],'where':{'id':_0x2a4485['params']['id']},'include':[{'model':db[_0x1eba('0x43')],'as':_0x1eba('0x44')}]},_0x47f620={};_0x47f620[_0x1eba('0x4b')]=_[_0x1eba('0x5e')](db['FaxAccount'][_0x1eba('0x47')]);_0x47f620[_0x1eba('0x4c')]=_['keys'](_0x2a4485[_0x1eba('0x4c')]);_0x47f620[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x47f620['model'],_0x47f620[_0x1eba('0x4c')]);_0x42934e[_0x1eba('0x4f')]=_[_0x1eba('0x4e')](_0x47f620['model'],qs[_0x1eba('0x50')](_0x2a4485[_0x1eba('0x4c')]['fields']));_0x42934e[_0x1eba('0x4f')]=_0x42934e['attributes'][_0x1eba('0x51')]?_0x42934e[_0x1eba('0x4f')]:_0x47f620['model'];if(_0x2a4485[_0x1eba('0x4c')][_0x1eba('0x5a')]){_0x42934e[_0x1eba('0x5b')]=[{'all':!![]}];}_0x42934e=_[_0x1eba('0x58')]({},_0x42934e,_0x2a4485[_0x1eba('0x59')]);return db['FaxAccount'][_0x1eba('0x5f')](_0x42934e)[_0x1eba('0x23')](handleEntityNotFound(_0x59ea59,null))[_0x1eba('0x23')](respondWithResult(_0x59ea59,null))['catch'](handleError(_0x59ea59,null));};exports[_0x1eba('0x60')]=function(_0x560215,_0x5e2d52){return db[_0x1eba('0x46')][_0x1eba('0x60')](_0x560215[_0x1eba('0x61')],{})[_0x1eba('0x23')](function(_0x5cd0b9){var _0x395622=_0x560215['user'][_0x1eba('0x3b')]({'plain':!![]});if(!_0x395622)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x395622[_0x1eba('0x62')]==='user'){var _0x2ee008=_0x5cd0b9[_0x1eba('0x3b')]({'plain':!![]});var _0x1d2c34='FaxAccounts';return db[_0x1eba('0x63')][_0x1eba('0x5f')]({'where':{'name':_0x1d2c34,'userProfileId':_0x395622['userProfileId']},'raw':!![]})[_0x1eba('0x23')](function(_0x38831f){if(_0x38831f&&_0x38831f[_0x1eba('0x64')]===0x0){return db[_0x1eba('0x3d')][_0x1eba('0x60')]({'name':_0x2ee008['name'],'resourceId':_0x2ee008['id'],'type':_0x38831f[_0x1eba('0x40')],'sectionId':_0x38831f['id']},{})[_0x1eba('0x23')](function(){return _0x5cd0b9;});}else{return _0x5cd0b9;}})[_0x1eba('0x2e')](function(_0xa8e9eb){logger['error'](_0x1eba('0x65'),_0xa8e9eb);throw _0xa8e9eb;});}return _0x5cd0b9;})['then'](respondWithResult(_0x5e2d52,0xc9))[_0x1eba('0x2e')](handleError(_0x5e2d52,null));};exports[_0x1eba('0x39')]=function(_0x529b4c,_0x2b6f04){if(_0x529b4c[_0x1eba('0x61')]['id']){delete _0x529b4c['body']['id'];}return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x529b4c['params']['id']},'include':[{'model':db[_0x1eba('0x43')],'as':_0x1eba('0x44')}]})[_0x1eba('0x23')](handleEntityNotFound(_0x2b6f04,null))[_0x1eba('0x23')](saveUpdates(_0x529b4c[_0x1eba('0x61')],null))[_0x1eba('0x23')](respondWithResult(_0x2b6f04,null))[_0x1eba('0x2e')](handleError(_0x2b6f04,null));};exports[_0x1eba('0x3a')]=function(_0x1d6ecd,_0x15502c){return db[_0x1eba('0x46')]['find']({'where':{'id':_0x1d6ecd[_0x1eba('0x66')]['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x15502c,null))[_0x1eba('0x23')](removeEntity(_0x15502c,null))[_0x1eba('0x2e')](handleError(_0x15502c,null));};exports[_0x1eba('0x67')]=function(_0x44bd96,_0x1c7063){return db[_0x1eba('0x46')][_0x1eba('0x67')]()[_0x1eba('0x23')](respondWithResult(_0x1c7063,null))['catch'](handleError(_0x1c7063,null));};exports[_0x1eba('0x68')]=function(_0x24159b,_0x3b9418,_0x3d7a75){if(_0x24159b[_0x1eba('0x61')]['id']){delete _0x24159b['body']['id'];}return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x24159b['params']['id']}})['then'](handleEntityNotFound(_0x3b9418,null))['then'](function(_0x287da6){if(_0x287da6){_0x24159b[_0x1eba('0x61')][_0x1eba('0x69')]=_0x287da6['id'];return db[_0x1eba('0x6a')][_0x1eba('0x60')](_0x24159b[_0x1eba('0x61')]);}})['then'](respondWithResult(_0x3b9418,null))[_0x1eba('0x2e')](handleError(_0x3b9418,null));};exports[_0x1eba('0x6b')]=function(_0x47d062,_0x3c767a,_0x4b0c98){var _0x3f858f={'raw':![],'where':{}};var _0x55e09={};var _0x190ff7={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1eba('0x6c')]({'where':{'id':_0x47d062[_0x1eba('0x66')]['id']}})['then'](handleEntityNotFound(_0x3c767a,null))[_0x1eba('0x23')](function(_0x5bdf1a){if(_0x5bdf1a){_0x55e09['model']=_[_0x1eba('0x5e')](db['Disposition'][_0x1eba('0x47')]);_0x55e09[_0x1eba('0x4c')]=_['keys'](_0x47d062['query']);_0x55e09[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x55e09[_0x1eba('0x4b')],_0x55e09[_0x1eba('0x4c')]);_0x3f858f[_0x1eba('0x4f')]=_[_0x1eba('0x4e')](_0x55e09['model'],qs[_0x1eba('0x50')](_0x47d062[_0x1eba('0x4c')]['fields']));_0x3f858f[_0x1eba('0x4f')]=_0x3f858f['attributes']['length']?_0x3f858f['attributes']:_0x55e09['model'];if(!_0x47d062[_0x1eba('0x4c')]['hasOwnProperty'](_0x1eba('0x52'))){_0x3f858f[_0x1eba('0x34')]=qs['limit'](_0x47d062[_0x1eba('0x4c')][_0x1eba('0x34')]);_0x3f858f[_0x1eba('0x32')]=qs[_0x1eba('0x32')](_0x47d062[_0x1eba('0x4c')][_0x1eba('0x32')]);}_0x3f858f[_0x1eba('0x53')]=qs[_0x1eba('0x54')](_0x47d062['query'][_0x1eba('0x54')]);_0x3f858f[_0x1eba('0x55')]=qs[_0x1eba('0x4d')](_[_0x1eba('0x56')](_0x47d062[_0x1eba('0x4c')],_0x55e09[_0x1eba('0x4d')]));_0x3f858f['where'][_0x1eba('0x69')]=_0x5bdf1a['id'];if(_0x47d062[_0x1eba('0x4c')][_0x1eba('0x57')]){_0x3f858f[_0x1eba('0x55')]=_[_0x1eba('0x58')](_0x3f858f[_0x1eba('0x55')],{'$or':_['map'](_0x3f858f['attributes'],function(_0x47cda3){var _0x1f0a3b={};_0x1f0a3b[_0x47cda3]={'$like':'%'+_0x47d062[_0x1eba('0x4c')][_0x1eba('0x57')]+'%'};return _0x1f0a3b;})});}_0x3f858f=_[_0x1eba('0x58')]({},_0x3f858f,_0x47d062[_0x1eba('0x59')]);return db[_0x1eba('0x6a')][_0x1eba('0x35')]({'where':_0x3f858f[_0x1eba('0x55')]})[_0x1eba('0x23')](function(_0x2c2070){_0x190ff7['count']=_0x2c2070;if(_0x47d062[_0x1eba('0x4c')][_0x1eba('0x5a')]){_0x3f858f[_0x1eba('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3f858f);})[_0x1eba('0x23')](function(_0xa56bf9){_0x190ff7[_0x1eba('0x5c')]=_0xa56bf9;return _0x190ff7;});}})[_0x1eba('0x23')](respondWithFilteredResult(_0x3c767a,_0x3f858f))[_0x1eba('0x2e')](handleError(_0x3c767a,null));};exports[_0x1eba('0x6d')]=function(_0x25b131,_0x2ef10a,_0x3407a5){return db[_0x1eba('0x46')]['find']({'where':{'id':_0x25b131['params']['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x2ef10a,null))['then'](function(_0x39012b){if(_0x39012b){return _0x39012b[_0x1eba('0x6d')](_0x25b131[_0x1eba('0x4c')][_0x1eba('0x6e')]);}})[_0x1eba('0x23')](respondWithStatusCode(_0x2ef10a,null))[_0x1eba('0x2e')](handleError(_0x2ef10a,null));};exports[_0x1eba('0x6f')]=function(_0x144597,_0x1a789a,_0x59fa51){if(_0x144597[_0x1eba('0x61')]['id']){delete _0x144597[_0x1eba('0x61')]['id'];}return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x144597[_0x1eba('0x66')]['id']}})['then'](handleEntityNotFound(_0x1a789a,null))[_0x1eba('0x23')](function(_0x35f01c){if(_0x35f01c){_0x144597['body'][_0x1eba('0x69')]=_0x35f01c['id'];return db[_0x1eba('0x70')][_0x1eba('0x60')](_0x144597[_0x1eba('0x61')]);}})[_0x1eba('0x23')](respondWithResult(_0x1a789a,null))[_0x1eba('0x2e')](handleError(_0x1a789a,null));};exports[_0x1eba('0x71')]=function(_0x42863b,_0x408bf2,_0x58f1b9){var _0x26ba82={'raw':![],'where':{}};var _0x304149={};var _0x3d1f87={'count':0x0,'rows':[]};return db[_0x1eba('0x46')][_0x1eba('0x6c')]({'where':{'id':_0x42863b[_0x1eba('0x66')]['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x408bf2,null))[_0x1eba('0x23')](function(_0x4a821f){if(_0x4a821f){_0x304149['model']=_[_0x1eba('0x5e')](db[_0x1eba('0x70')][_0x1eba('0x47')]);_0x304149['query']=_['keys'](_0x42863b[_0x1eba('0x4c')]);_0x304149[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x304149[_0x1eba('0x4b')],_0x304149['query']);_0x26ba82[_0x1eba('0x4f')]=_[_0x1eba('0x4e')](_0x304149[_0x1eba('0x4b')],qs[_0x1eba('0x50')](_0x42863b[_0x1eba('0x4c')][_0x1eba('0x50')]));_0x26ba82['attributes']=_0x26ba82[_0x1eba('0x4f')][_0x1eba('0x51')]?_0x26ba82[_0x1eba('0x4f')]:_0x304149['model'];if(!_0x42863b[_0x1eba('0x4c')]['hasOwnProperty']('nolimit')){_0x26ba82[_0x1eba('0x34')]=qs['limit'](_0x42863b[_0x1eba('0x4c')][_0x1eba('0x34')]);_0x26ba82[_0x1eba('0x32')]=qs[_0x1eba('0x32')](_0x42863b[_0x1eba('0x4c')][_0x1eba('0x32')]);}_0x26ba82[_0x1eba('0x53')]=qs[_0x1eba('0x54')](_0x42863b[_0x1eba('0x4c')][_0x1eba('0x54')]);_0x26ba82[_0x1eba('0x55')]=qs['filters'](_['pick'](_0x42863b['query'],_0x304149['filters']));_0x26ba82[_0x1eba('0x55')][_0x1eba('0x69')]=_0x4a821f['id'];if(_0x42863b[_0x1eba('0x4c')]['filter']){_0x26ba82[_0x1eba('0x55')]=_[_0x1eba('0x58')](_0x26ba82[_0x1eba('0x55')],{'$or':_[_0x1eba('0x45')](_0x26ba82[_0x1eba('0x4f')],function(_0x25e67e){var _0x3561e3={};_0x3561e3[_0x25e67e]={'$like':'%'+_0x42863b[_0x1eba('0x4c')][_0x1eba('0x57')]+'%'};return _0x3561e3;})});}_0x26ba82=_[_0x1eba('0x58')]({},_0x26ba82,_0x42863b[_0x1eba('0x59')]);return db[_0x1eba('0x70')][_0x1eba('0x35')]({'where':_0x26ba82[_0x1eba('0x55')]})[_0x1eba('0x23')](function(_0x2dd565){_0x3d1f87[_0x1eba('0x35')]=_0x2dd565;if(_0x42863b[_0x1eba('0x4c')][_0x1eba('0x5a')]){_0x26ba82[_0x1eba('0x5b')]=[{'all':!![]}];}return db[_0x1eba('0x70')]['findAll'](_0x26ba82);})[_0x1eba('0x23')](function(_0x2f2bd0){_0x3d1f87[_0x1eba('0x5c')]=_0x2f2bd0;return _0x3d1f87;});}})[_0x1eba('0x23')](respondWithFilteredResult(_0x408bf2,_0x26ba82))[_0x1eba('0x2e')](handleError(_0x408bf2,null));};exports[_0x1eba('0x72')]=function(_0x1168d9,_0x47db91,_0x30afc4){return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x1168d9['params']['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x47db91,null))['then'](function(_0x4f7812){if(_0x4f7812){return _0x4f7812['removeAnswers'](_0x1168d9[_0x1eba('0x4c')][_0x1eba('0x6e')]);}})['then'](respondWithStatusCode(_0x47db91,null))['catch'](handleError(_0x47db91,null));};exports[_0x1eba('0x73')]=function(_0x5ba892,_0x3a659b,_0xa48fed){return db[_0x1eba('0x74')][_0x1eba('0x5f')]({'where':{'id':_0x5ba892[_0x1eba('0x66')]['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x3a659b,null))['then'](function(_0xc48067){if(_0xc48067){return _0xc48067[_0x1eba('0x73')](_0x5ba892[_0x1eba('0x61')][_0x1eba('0x6e')],_[_0x1eba('0x75')](_0x5ba892[_0x1eba('0x61')],[_0x1eba('0x6e'),'id'])||{});}})[_0x1eba('0x23')](respondWithResult(_0x3a659b,null))[_0x1eba('0x2e')](handleError(_0x3a659b,null));};exports[_0x1eba('0x76')]=function(_0x3d2816,_0x226a88,_0x196e63){var _0x2fb90c={'raw':![],'where':{}};var _0x473ced={};var _0x15e86a={'count':0x0,'rows':[]};return db[_0x1eba('0x46')][_0x1eba('0x6c')]({'where':{'id':_0x3d2816[_0x1eba('0x66')]['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x226a88,null))[_0x1eba('0x23')](function(_0x559996){if(_0x559996){_0x473ced['model']=_[_0x1eba('0x5e')](db['FaxInteraction'][_0x1eba('0x47')]);_0x473ced[_0x1eba('0x4c')]=_[_0x1eba('0x5e')](_0x3d2816[_0x1eba('0x4c')]);_0x473ced[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x473ced[_0x1eba('0x4b')],_0x473ced[_0x1eba('0x4c')]);_0x2fb90c[_0x1eba('0x4f')]=_['intersection'](_0x473ced[_0x1eba('0x4b')],qs[_0x1eba('0x50')](_0x3d2816[_0x1eba('0x4c')]['fields']));_0x2fb90c[_0x1eba('0x4f')]=_0x2fb90c['attributes'][_0x1eba('0x51')]?_0x2fb90c['attributes']:_0x473ced[_0x1eba('0x4b')];if(!_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x77')]('nolimit')){_0x2fb90c['limit']=qs[_0x1eba('0x34')](_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x34')]);_0x2fb90c['offset']=qs['offset'](_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x32')]);}_0x2fb90c['order']=qs[_0x1eba('0x54')](_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x54')]);_0x2fb90c[_0x1eba('0x55')]=qs[_0x1eba('0x4d')](_['pick'](_0x3d2816['query'],_0x473ced[_0x1eba('0x4d')]));_0x2fb90c[_0x1eba('0x55')][_0x1eba('0x69')]=_0x559996['id'];if(_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x57')]){_0x2fb90c[_0x1eba('0x55')]=_['merge'](_0x2fb90c[_0x1eba('0x55')],{'$or':_[_0x1eba('0x45')](_0x2fb90c[_0x1eba('0x4f')],function(_0xbc4596){var _0x559357={};_0x559357[_0xbc4596]={'$like':'%'+_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x57')]+'%'};return _0x559357;})});}_0x2fb90c=_['merge']({},_0x2fb90c,_0x3d2816[_0x1eba('0x59')]);return db[_0x1eba('0x74')]['count']({'where':_0x2fb90c[_0x1eba('0x55')]})[_0x1eba('0x23')](function(_0x40c14d){_0x15e86a['count']=_0x40c14d;if(_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x5a')]){_0x2fb90c['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1eba('0x78')],'as':_0x1eba('0x79'),'attributes':[_0x1eba('0x40'),_0x1eba('0x7a'),_0x1eba('0x7b')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x1eba('0x7c')],'where':_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x7d')]?{'id':_0x3d2816[_0x1eba('0x4c')][_0x1eba('0x7d')]}:undefined,'required':_0x3d2816[_0x1eba('0x4c')]['tag']?!![]:![]}];}return db[_0x1eba('0x74')][_0x1eba('0x7e')](_0x2fb90c);})[_0x1eba('0x23')](function(_0x5eeb1c){_0x15e86a['rows']=_0x5eeb1c;return _0x15e86a;});}})[_0x1eba('0x23')](respondWithFilteredResult(_0x226a88,_0x2fb90c))[_0x1eba('0x2e')](handleError(_0x226a88,null));};exports['addApplications']=function(_0x33d893,_0x4e663d){var _0xb85f3=_0x33d893[_0x1eba('0x66')]['id'];var _0x2afba3=_0x33d893['body'];var _0x377658=0xc8;var _0x48b4d9=null;return db[_0x1eba('0x7f')][_0x1eba('0x80')]({'isolationLevel':db['sequelize'][_0x1eba('0x81')][_0x1eba('0x82')][_0x1eba('0x83')]},function(_0x4357b8){return db[_0x1eba('0x46')][_0x1eba('0x6c')]({'where':{'id':_0xb85f3},'transaction':_0x4357b8})[_0x1eba('0x23')](function(_0x47eb59){if(_0x47eb59){return db[_0x1eba('0x84')][_0x1eba('0x3a')]({'where':{'FaxAccountId':_0xb85f3},'transaction':_0x4357b8})[_0x1eba('0x23')](function(){var _0x2e9ddb=_['map'](_0x2afba3,function(_0x528078){_0x528078['FaxAccountId']=_0xb85f3;return _0x528078;});return db['FaxApplication'][_0x1eba('0x85')](_0x2e9ddb,{'transaction':_0x4357b8});});}else{_0x377658=0x194;_0x48b4d9=[];}});})[_0x1eba('0x23')](function(){if(_0x377658!==0x194){return db[_0x1eba('0x84')][_0x1eba('0x86')]({'where':{'FaxAccountId':_0xb85f3},'order':_0x1eba('0x87')})[_0x1eba('0x23')](function(_0x49b8b4){_0x48b4d9=_0x49b8b4;});}})['catch'](function(_0x34f9da){_0x377658=0x1f4;logger[_0x1eba('0x2a')](_0x34f9da['stack']);if(_0x34f9da[_0x1eba('0x40')]){delete _0x34f9da[_0x1eba('0x40')];}_0x48b4d9=_0x34f9da;})[_0x1eba('0x88')](function(){if(_0x48b4d9===null){_0x4e663d[_0x1eba('0x3e')](_0x377658);}else{if(_0x377658===0x1f4){_0x4e663d['status'](_0x377658)['send'](_0x48b4d9);}else{_0x4e663d[_0x1eba('0x2f')](_0x377658)[_0x1eba('0x31')](_0x48b4d9);}}});};exports[_0x1eba('0x89')]=function(_0x5cb413,_0x1eed4d,_0x3e1253){var _0x5d4a1e={};var _0x35f5fb={};var _0x36fbd7;var _0x5b563f;return db[_0x1eba('0x46')]['findOne']({'where':{'id':_0x5cb413['params']['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x1eed4d,null))[_0x1eba('0x23')](function(_0x102d3e){if(_0x102d3e){_0x36fbd7=_0x102d3e;_0x35f5fb[_0x1eba('0x4b')]=_[_0x1eba('0x5e')](db[_0x1eba('0x84')][_0x1eba('0x47')]);_0x35f5fb[_0x1eba('0x4c')]=_[_0x1eba('0x5e')](_0x5cb413[_0x1eba('0x4c')]);_0x35f5fb[_0x1eba('0x4d')]=_['intersection'](_0x35f5fb['model'],_0x35f5fb[_0x1eba('0x4c')]);_0x5d4a1e['attributes']=_['intersection'](_0x35f5fb['model'],qs[_0x1eba('0x50')](_0x5cb413[_0x1eba('0x4c')][_0x1eba('0x50')]));_0x5d4a1e['attributes']=_0x5d4a1e[_0x1eba('0x4f')]['length']?_0x5d4a1e[_0x1eba('0x4f')]:_0x35f5fb[_0x1eba('0x4b')];_0x5d4a1e['order']=qs[_0x1eba('0x54')](_0x5cb413[_0x1eba('0x4c')]['sort']);_0x5d4a1e[_0x1eba('0x55')]=qs[_0x1eba('0x4d')](_[_0x1eba('0x56')](_0x5cb413[_0x1eba('0x4c')],_0x35f5fb['filters']));if(_0x5cb413[_0x1eba('0x4c')][_0x1eba('0x57')]){_0x5d4a1e[_0x1eba('0x55')]=_['merge'](_0x5d4a1e['where'],{'$or':_[_0x1eba('0x45')](_0x5d4a1e['attributes'],function(_0x20b21d){var _0x416ed1={};_0x416ed1[_0x20b21d]={'$like':'%'+_0x5cb413[_0x1eba('0x4c')][_0x1eba('0x57')]+'%'};return _0x416ed1;})});}_0x5d4a1e=_['merge']({},_0x5d4a1e,_0x5cb413[_0x1eba('0x59')]);return _0x36fbd7[_0x1eba('0x89')](_0x5d4a1e);}})[_0x1eba('0x23')](function(_0x37d6f3){if(_0x37d6f3){_0x5b563f=_0x37d6f3[_0x1eba('0x51')];if(!_0x5cb413[_0x1eba('0x4c')][_0x1eba('0x77')](_0x1eba('0x52'))){_0x5d4a1e[_0x1eba('0x34')]=qs[_0x1eba('0x34')](_0x5cb413[_0x1eba('0x4c')]['limit']);_0x5d4a1e[_0x1eba('0x32')]=qs[_0x1eba('0x32')](_0x5cb413[_0x1eba('0x4c')][_0x1eba('0x32')]);}return _0x36fbd7[_0x1eba('0x89')](_0x5d4a1e);}})[_0x1eba('0x23')](function(_0x18514f){if(_0x18514f){return _0x18514f?{'count':_0x5b563f,'rows':_0x18514f}:null;}})[_0x1eba('0x23')](respondWithResult(_0x1eed4d,null))[_0x1eba('0x2e')](handleError(_0x1eed4d,null));};function Extension(_0x2180a1,_0xb12fd9,_0x3f8300,_0x1562e7){this['context']=_0x1eba('0x8a');this[_0x1eba('0x8b')]=_0x2180a1[_0x1eba('0x8c')];this[_0x1eba('0x8d')]=_0x1562e7;this['type']=_0x1eba('0x8e');this['description']=_0x1eba('0x8f');this['FaxAccountId']=_0x2180a1['id'];this['priority']=_0xb12fd9;this[_0x1eba('0x90')]=_0x3f8300;}function createExtensionsReciveFax(_0x51c711){var _0x346d7f=0x1;var _0x37d24a=[];_0x37d24a[_0x1eba('0x91')](new Extension(_0x51c711,_0x346d7f,'',_0x1eba('0x92')));_0x346d7f+=0x1;_0x37d24a['push'](new Extension(_0x51c711,_0x346d7f,'CDR(type)=inbound-fax',_0x1eba('0x93')));_0x346d7f+=0x1;for(var _0x3df33b in _0x51c711){if(_0x51c711[_0x1eba('0x77')](_0x3df33b)&&(_0x3df33b==='ecm'||_0x3df33b===_0x1eba('0x8c')||_0x3df33b===_0x1eba('0x94')||_0x3df33b===_0x1eba('0x95')||_0x3df33b==='headerinfo'||_0x3df33b===_0x1eba('0x96')||_0x3df33b===_0x1eba('0x97')||_0x3df33b==='modem'||_0x3df33b===_0x1eba('0x98'))){_0x37d24a[_0x1eba('0x91')](new Extension(_0x51c711,_0x346d7f,_0x1eba('0x99')+_0x3df33b+')='+_0x51c711[_0x3df33b],_0x1eba('0x93')));_0x346d7f+=0x1;}}_0x37d24a[_0x1eba('0x91')](new Extension(_0x51c711,_0x346d7f,'6',_0x1eba('0x9a')));_0x346d7f+=0x1;_0x37d24a[_0x1eba('0x91')](new Extension(_0x51c711,_0x346d7f,_0x1eba('0x9b'),_0x1eba('0x9c')));_0x346d7f=0x0;return _0x37d24a;}exports[_0x1eba('0x9d')]=function(_0x5dae26,_0x4ebf69,_0x3fef4b){var _0x4d2494;return db[_0x1eba('0x7f')][_0x1eba('0x80')](function(_0x59e393){return db['FaxAccount'][_0x1eba('0x60')](_0x5dae26[_0x1eba('0x61')],{'transaction':_0x59e393})['then'](function(_0x172c3c){_0x4d2494=_0x172c3c[_0x1eba('0x3b')]({'plain':!![]});return db[_0x1eba('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x4d2494),{'transaction':_0x59e393});});})['then'](function(){return _0x4d2494;})[_0x1eba('0x23')](respondWithResult(_0x4ebf69,null))[_0x1eba('0x2e')](handleError(_0x4ebf69,null));};exports[_0x1eba('0x9f')]=function(_0x33dce9,_0xf79f26,_0x29541d){var _0x5c0f61;return db[_0x1eba('0x7f')][_0x1eba('0x80')](function(_0x157dff){return db['FaxAccount'][_0x1eba('0x39')](_0x33dce9[_0x1eba('0x61')],{'where':{'id':_0x33dce9[_0x1eba('0x61')]['id']},'transaction':_0x157dff})[_0x1eba('0x23')](function(_0x251a38){return db[_0x1eba('0x9e')][_0x1eba('0x3a')]({'where':{'FaxAccountId':_0x33dce9[_0x1eba('0x61')]['id']},'transaction':_0x157dff})['then'](function(_0x1ffca3){return db['VoiceExtension'][_0x1eba('0x85')](createExtensionsReciveFax(_['omit'](_0x33dce9[_0x1eba('0x61')],[_0x1eba('0xa0'),'key',_0x1eba('0xa1'),_0x1eba('0xa2'),'TrunkId',_0x1eba('0xa3')])),{'transaction':_0x157dff});});});})[_0x1eba('0x23')](function(){return db['FaxAccount']['findById'](_0x33dce9[_0x1eba('0x61')]['id']);})[_0x1eba('0x23')](respondWithResult(_0xf79f26,null))[_0x1eba('0x2e')](handleError(_0xf79f26,null));};exports[_0x1eba('0xa4')]=function(_0x2e3848,_0x367ce9,_0xf80ce5){var _0x357281={'raw':!![],'where':{}};var _0x1232e4={};var _0x2e1db9={'count':0x0,'rows':[]};return db[_0x1eba('0x46')]['findOne']({'where':{'id':_0x2e3848[_0x1eba('0x66')]['id']}})['then'](handleEntityNotFound(_0x367ce9,null))[_0x1eba('0x23')](function(_0x40f9f8){if(_0x40f9f8){_0x1232e4['model']=_[_0x1eba('0x5e')](db['FaxMessage'][_0x1eba('0x47')]);_0x1232e4[_0x1eba('0x4c')]=_[_0x1eba('0x5e')](_0x2e3848[_0x1eba('0x4c')]);_0x1232e4['filters']=_[_0x1eba('0x4e')](_0x1232e4[_0x1eba('0x4b')],_0x1232e4[_0x1eba('0x4c')]);_0x357281['attributes']=_[_0x1eba('0x4e')](_0x1232e4['model'],qs[_0x1eba('0x50')](_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x50')]));_0x357281[_0x1eba('0x4f')]=_0x357281['attributes'][_0x1eba('0x51')]?_0x357281[_0x1eba('0x4f')]:_0x1232e4[_0x1eba('0x4b')];if(!_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x77')](_0x1eba('0x52'))){_0x357281[_0x1eba('0x34')]=qs['limit'](_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x34')]);_0x357281[_0x1eba('0x32')]=qs['offset'](_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x32')]);}_0x357281['order']=qs[_0x1eba('0x54')](_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x54')]);_0x357281['where']=qs[_0x1eba('0x4d')](_[_0x1eba('0x56')](_0x2e3848[_0x1eba('0x4c')],_0x1232e4[_0x1eba('0x4d')]));_0x357281[_0x1eba('0x55')][_0x1eba('0x69')]=_0x40f9f8['id'];if(_0x2e3848[_0x1eba('0x4c')][_0x1eba('0x57')]){_0x357281['where']=_[_0x1eba('0x58')](_0x357281[_0x1eba('0x55')],{'$or':_[_0x1eba('0x45')](_0x357281[_0x1eba('0x4f')],function(_0x29d87f){var _0x3bc7f1={};_0x3bc7f1[_0x29d87f]={'$like':'%'+_0x2e3848[_0x1eba('0x4c')]['filter']+'%'};return _0x3bc7f1;})});}if(_0x2e3848[_0x1eba('0x4c')][_0x1eba('0xa5')]){var _0xb255ef=_0x2e3848[_0x1eba('0x4c')][_0x1eba('0xa5')]['split'](',');var _0x6dedb4={};_0x6dedb4[_0xb255ef[0x0]]={'$gte':moment(_0xb255ef[0x1])[_0x1eba('0xa6')](_0x1eba('0xa7'))};_0x357281[_0x1eba('0x55')]=_[_0x1eba('0x58')](_0x357281[_0x1eba('0x55')],_0x6dedb4);}_0x357281=_[_0x1eba('0x58')]({},_0x357281,_0x2e3848[_0x1eba('0x59')]);return db[_0x1eba('0xa8')]['count']({'where':_0x357281[_0x1eba('0x55')]})[_0x1eba('0x23')](function(_0x43e4f5){_0x2e1db9[_0x1eba('0x35')]=_0x43e4f5;if(_0x2e3848['query']['includeAll']){_0x357281['include']=[{'all':!![]}];}return db['FaxMessage'][_0x1eba('0x7e')](_0x357281);})[_0x1eba('0x23')](function(_0x42456a){_0x2e1db9[_0x1eba('0x5c')]=_0x42456a;return _0x2e1db9;});}})[_0x1eba('0x23')](respondWithFilteredResult(_0x367ce9,_0x357281))[_0x1eba('0x2e')](handleError(_0x367ce9,null));};exports[_0x1eba('0x41')]=function(_0x31f2df,_0x77485e,_0x1c110d){var _0x4966c7,_0x12f95b={},_0x31c11e;if(_0x31f2df['body']['to']){_0x31c11e=_0x31f2df[_0x1eba('0x61')]['to'][0x0];}return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x31f2df['params']['id']},'include':[{'model':db[_0x1eba('0xa9')],'as':_0x1eba('0xaa'),'include':[{'model':db[_0x1eba('0xab')],'as':_0x1eba('0xac'),'where':{'fax':_0x31c11e},'limit':0x1,'order':[[_0x1eba('0xa2'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x77485e,null))['then'](function(_0x3a4828){_0x4966c7=_0x3a4828;if(_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')]&&_0x31f2df[_0x1eba('0x61')]['attachments'][_0x1eba('0x51')]){for(var _0x1ac1d0=0x0;_0x1ac1d0<_0x31f2df['body'][_0x1eba('0xad')]['length'];_0x1ac1d0+=0x1){_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][_0x1ac1d0]={'filename':_0x31f2df['body'][_0x1eba('0xad')][_0x1ac1d0]['name'],'id':_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][_0x1ac1d0]['id'],'path':path[_0x1eba('0xae')](config[_0x1eba('0xaf')],_0x1eba('0xb0'),_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][_0x1ac1d0]['basename'])};}}return respondWithRpcPromise(_0x1eba('0xb1'),_0x1eba('0xb1'),{'FaxAccountId':_[_0x1eba('0xb2')](_0x31f2df['params']['id'])?undefined:_0x31f2df[_0x1eba('0x66')]['id'],'path':_[_0x1eba('0xb2')](_0x31f2df['body']['attachments'][0x0][_0x1eba('0x8')])?undefined:_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][0x0]['path'],'fax':_[_0x1eba('0xb2')](_0x31f2df[_0x1eba('0x61')]['to'][0x0])?undefined:_0x31f2df[_0x1eba('0x61')]['to'][0x0]},client9002);})[_0x1eba('0x23')](function(){if(_0x4966c7){if(_[_0x1eba('0xb2')](_0x31f2df[_0x1eba('0x61')][_0x1eba('0xb3')])){_0x31f2df[_0x1eba('0x61')][_0x1eba('0xb3')]=util[_0x1eba('0xa6')](_0x1eba('0xb4'),_0x4966c7[_0x1eba('0x40')],_0x4966c7['fax']);}if(_0x4966c7[_0x1eba('0xaa')]){if(_0x4966c7['List'][_0x1eba('0xac')]['length']){return _0x4966c7[_0x1eba('0xaa')][_0x1eba('0xac')][0x0];}else{return db[_0x1eba('0xab')]['create'](_['defaults'](_0x31f2df[_0x1eba('0x61')],{'firstName':_0x31f2df[_0x1eba('0x61')]['to'][0x0],'phone':_0x31f2df['body']['to'][0x0],'fax':_0x31f2df[_0x1eba('0x61')]['to'][0x0],'ListId':_0x4966c7[_0x1eba('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1eba('0x23')](function(_0x245599){if(_0x245599){return db[_0x1eba('0x74')][_0x1eba('0x5f')]({'where':{'ContactId':_0x245599['id'],'closed':![],'FaxAccountId':_0x4966c7['id']}})[_0x1eba('0x23')](function(_0x2f301e){if(_0x2f301e){return[_0x2f301e,![]];}return db['FaxInteraction']['create']({'UserId':_0x31f2df[_0x1eba('0xb5')]['id'],'ContactId':_0x245599['id'],'FaxAccountId':_0x4966c7['id'],'fax':_0x31f2df[_0x1eba('0x61')]['to'][0x0],'firstMsgDirection':_0x1eba('0xb6'),'Messages':[_[_0x1eba('0x58')](_0x31f2df['body'],{'read':![],'body':_0x31f2df['body'][_0x1eba('0xad')][0x0][_0x1eba('0xb7')],'FaxAccountId':_0x4966c7['id'],'UserId':_0x31f2df[_0x1eba('0xb5')]['id'],'ContactId':_0x245599['id'],'AttachmentId':_0x31f2df[_0x1eba('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x1eba('0xa8')],'as':_0x1eba('0xb8')}]})[_0x1eba('0x23')](function(_0x25caad){return[_0x25caad,!![]];});});}else{throw new Error(_0x1eba('0xb9'));}})[_0x1eba('0xba')](function(_0x2b3090,_0x9744d7){if(_0x9744d7){return _0x2b3090;}return db['FaxMessage'][_0x1eba('0x60')]({'direction':_0x1eba('0xb6'),'read':![],'body':_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][0x0]['filename'],'FaxAccountId':_0x4966c7['id'],'FaxInteractionId':_0x2b3090['id'],'UserId':_0x31f2df['user']['id'],'ContactId':_0x2b3090[_0x1eba('0xbb')],'AttachmentId':_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][0x0]['id']})[_0x1eba('0x23')](function(_0xa9e3b6){_0x2b3090[_0x1eba('0xbc')][_0x1eba('0xb8')]=[];_0x2b3090[_0x1eba('0xbc')]['Messages'][_0x1eba('0x91')](_0xa9e3b6['dataValues']);return _0x2b3090;});})['then'](function(_0x151808){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x1eba('0xb2')](_0x31f2df[_0x1eba('0x66')]['id'])?undefined:_0x31f2df[_0x1eba('0x66')]['id'],'path':_['isNil'](_0x31f2df['body']['attachments'][0x0][_0x1eba('0x8')])?undefined:_0x31f2df['body']['attachments'][0x0][_0x1eba('0x8')],'fax':_['isNil'](_0x31f2df[_0x1eba('0x61')]['to'][0x0])?undefined:_0x31f2df[_0x1eba('0x61')]['to'][0x0],'AttachmentId':_0x31f2df[_0x1eba('0x61')][_0x1eba('0xad')][0x0]['id']},client9002)['then'](function(_0x3a952c){logger['info'](_0x1eba('0xbd'),_0x3a952c);})[_0x1eba('0x2e')](function(_0x28b9ac){logger[_0x1eba('0x24')]('SendFaxRpc,\x20%s',_0x28b9ac);});return _0x151808;})[_0x1eba('0x23')](respondWithResult(_0x77485e,null))['catch'](handleError(_0x77485e,null));};exports['addAgents']=function(_0x4ae6a8,_0x501942,_0x190270){return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x4ae6a8[_0x1eba('0x66')]['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x501942,null))['then'](function(_0xf9fa47){if(_0xf9fa47){return _0xf9fa47[_0x1eba('0xbe')](_0x4ae6a8[_0x1eba('0x61')][_0x1eba('0x6e')],_['omit'](_0x4ae6a8[_0x1eba('0x61')],[_0x1eba('0x6e'),'id'])||{})[_0x1eba('0xba')](function(_0x27ca16){for(var _0x16dfbf=0x0;_0x16dfbf<_0x4ae6a8[_0x1eba('0x61')][_0x1eba('0x6e')][_0x1eba('0x51')];_0x16dfbf+=0x1){socket[_0x1eba('0xbf')](_0x1eba('0xc0'),{'UserId':Number(_0x4ae6a8['body']['ids'][_0x16dfbf]),'FaxAccountId':Number(_0x4ae6a8[_0x1eba('0x66')]['id'])});}return _0x27ca16;});}})['then'](respondWithResult(_0x501942,null))['catch'](handleError(_0x501942,null));};exports[_0x1eba('0xc1')]=function(_0x454f32,_0x448325,_0x3dfef6){return db[_0x1eba('0x46')][_0x1eba('0x5f')]({'where':{'id':_0x454f32['params']['id']}})[_0x1eba('0x23')](handleEntityNotFound(_0x448325,null))['then'](function(_0x4d8cb7){if(_0x4d8cb7){return _0x4d8cb7[_0x1eba('0xc1')](_0x454f32[_0x1eba('0x4c')]['ids'])['then'](function(){if(_[_0x1eba('0xc2')](_0x454f32[_0x1eba('0x4c')][_0x1eba('0x6e')])){for(var _0x15e8d3=0x0;_0x15e8d3<_0x454f32[_0x1eba('0x4c')][_0x1eba('0x6e')][_0x1eba('0x51')];_0x15e8d3+=0x1){socket[_0x1eba('0xbf')](_0x1eba('0xc3'),{'UserId':Number(_0x454f32[_0x1eba('0x4c')][_0x1eba('0x6e')][_0x15e8d3]),'FaxAccountId':Number(_0x454f32[_0x1eba('0x66')]['id'])});}}else{socket[_0x1eba('0xbf')](_0x1eba('0xc3'),{'UserId':Number(_0x454f32[_0x1eba('0x4c')][_0x1eba('0x6e')]),'FaxAccountId':Number(_0x454f32['params']['id'])});}});}})[_0x1eba('0x23')](respondWithStatusCode(_0x448325,null))['catch'](handleError(_0x448325,null));};exports[_0x1eba('0xc4')]=function(_0x46fdb8,_0x33056c,_0x73e625){var _0x14ac9c={};var _0x300a84={};var _0x45ebb5;var _0x52ebe2;return db[_0x1eba('0x46')][_0x1eba('0x6c')]({'where':{'id':_0x46fdb8[_0x1eba('0x66')]['id']}})['then'](handleEntityNotFound(_0x33056c,null))[_0x1eba('0x23')](function(_0x23aedf){if(_0x23aedf){_0x45ebb5=_0x23aedf;_0x300a84[_0x1eba('0x4b')]=_[_0x1eba('0x5e')](db[_0x1eba('0x78')]['rawAttributes']);_0x300a84[_0x1eba('0x4c')]=_['keys'](_0x46fdb8['query']);_0x300a84[_0x1eba('0x4d')]=_[_0x1eba('0x4e')](_0x300a84[_0x1eba('0x4b')],_0x300a84[_0x1eba('0x4c')]);_0x14ac9c['attributes']=_[_0x1eba('0x4e')](_0x300a84[_0x1eba('0x4b')],qs[_0x1eba('0x50')](_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x50')]));_0x14ac9c[_0x1eba('0x4f')]=_0x14ac9c[_0x1eba('0x4f')][_0x1eba('0x51')]?_0x14ac9c[_0x1eba('0x4f')]:_0x300a84[_0x1eba('0x4b')];_0x14ac9c[_0x1eba('0x53')]=qs[_0x1eba('0x54')](_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x54')]);_0x14ac9c[_0x1eba('0x55')]=qs['filters'](_['pick'](_0x46fdb8[_0x1eba('0x4c')],_0x300a84['filters']));if(_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x57')]){_0x14ac9c[_0x1eba('0x55')]=_[_0x1eba('0x58')](_0x14ac9c['where'],{'$or':_[_0x1eba('0x45')](_0x14ac9c['attributes'],function(_0x1f1230){var _0x32b918={};_0x32b918[_0x1f1230]={'$like':'%'+_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x57')]+'%'};return _0x32b918;})});}_0x14ac9c=_[_0x1eba('0x58')]({},_0x14ac9c,_0x46fdb8[_0x1eba('0x59')]);return _0x45ebb5[_0x1eba('0xc4')](_0x14ac9c);}})['then'](function(_0x547b32){if(_0x547b32){_0x52ebe2=_0x547b32['length'];if(!_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x77')](_0x1eba('0x52'))){_0x14ac9c[_0x1eba('0x34')]=qs[_0x1eba('0x34')](_0x46fdb8[_0x1eba('0x4c')]['limit']);_0x14ac9c[_0x1eba('0x32')]=qs[_0x1eba('0x32')](_0x46fdb8[_0x1eba('0x4c')][_0x1eba('0x32')]);}return _0x45ebb5[_0x1eba('0xc4')](_0x14ac9c);}})[_0x1eba('0x23')](function(_0x42481a){if(_0x42481a){return _0x42481a?{'count':_0x52ebe2,'rows':_0x42481a}:null;}})['then'](respondWithResult(_0x33056c,null))[_0x1eba('0x2e')](handleError(_0x33056c,null));};
\ No newline at end of file