Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / faxAccount / faxAccount.controller.js
index f3cb210..451d9db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xa2a0=['../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxAccount','includeAll','findAll','show','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','FaxAccounts','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','rawAttributes','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','push','Answer','Set','ecm','localstationid','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','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','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa2a0,0x173));var _0x0a2a=function(_0x348fc2,_0x5cbe66){_0x348fc2=_0x348fc2-0x0;var _0x815f26=_0xa2a0[_0x348fc2];return _0x815f26;};'use strict';var emlformat=require(_0x0a2a('0x0'));var rimraf=require(_0x0a2a('0x1'));var zipdir=require(_0x0a2a('0x2'));var jsonpatch=require(_0x0a2a('0x3'));var rp=require(_0x0a2a('0x4'));var moment=require(_0x0a2a('0x5'));var BPromise=require(_0x0a2a('0x6'));var Mustache=require(_0x0a2a('0x7'));var util=require(_0x0a2a('0x8'));var path=require(_0x0a2a('0x9'));var sox=require(_0x0a2a('0xa'));var csv=require(_0x0a2a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a2a('0xc'));var _=require(_0x0a2a('0xd'));var squel=require('squel');var crypto=require(_0x0a2a('0xe'));var jsforce=require(_0x0a2a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a2a('0x10'));var Redis=require('ioredis');var authService=require(_0x0a2a('0x11'));var qs=require(_0x0a2a('0x12'));var as=require(_0x0a2a('0x13'));var hardwareService=require(_0x0a2a('0x14'));var logger=require(_0x0a2a('0x15'))(_0x0a2a('0x16'));var utils=require(_0x0a2a('0x17'));var config=require(_0x0a2a('0x18'));var licenseUtil=require(_0x0a2a('0x19'));var db=require(_0x0a2a('0x1a'))['db'];config['redis']=_[_0x0a2a('0x1b')](config['redis'],{'host':_0x0a2a('0x1c'),'port':0x18eb});var socket=require(_0x0a2a('0x1d'))(new Redis(config[_0x0a2a('0x1e')]));require(_0x0a2a('0x1f'))[_0x0a2a('0x20')](socket);var jayson=require(_0x0a2a('0x21'));var client=jayson[_0x0a2a('0x22')][_0x0a2a('0x23')]({'port':0x232c});var client9002=jayson[_0x0a2a('0x22')][_0x0a2a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x386a50,_0x406e70,_0x115122,_0x1b078e){return new BPromise(function(_0x1dad93,_0x3fb6a6){var _0x1bd746=_0x1b078e||client;return _0x1bd746[_0x0a2a('0x24')](_0x386a50,_0x115122)['then'](function(_0xd21580){logger[_0x0a2a('0x25')](_0x0a2a('0x26'),_0x406e70,_0x0a2a('0x27'));logger[_0x0a2a('0x28')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x406e70,_0x0a2a('0x27'),JSON['stringify'](_0xd21580));if(_0xd21580[_0x0a2a('0x29')]){if(_0xd21580['error']['code']===0x1f4){logger['error'](_0x0a2a('0x26'),_0x406e70,_0xd21580[_0x0a2a('0x29')][_0x0a2a('0x2a')]);return _0x3fb6a6(_0xd21580['error'][_0x0a2a('0x2a')]);}logger[_0x0a2a('0x29')](_0x0a2a('0x26'),_0x406e70,_0xd21580[_0x0a2a('0x29')][_0x0a2a('0x2a')]);return _0x1dad93(_0xd21580['error']['message']);}else{logger[_0x0a2a('0x25')]('FaxAccount,\x20%s,\x20%s',_0x406e70,_0x0a2a('0x27'));_0x1dad93(_0xd21580[_0x0a2a('0x2b')][_0x0a2a('0x2a')]);}})[_0x0a2a('0x2c')](function(_0x27dfdd){logger[_0x0a2a('0x29')](_0x0a2a('0x26'),_0x406e70,_0x27dfdd);_0x3fb6a6(_0x27dfdd);});});}function respondWithStatusCode(_0x2894aa,_0x4aac1b){_0x4aac1b=_0x4aac1b||0xcc;return function(_0x1a3e71){if(_0x1a3e71){return _0x2894aa['sendStatus'](_0x4aac1b);}return _0x2894aa[_0x0a2a('0x2d')](_0x4aac1b)[_0x0a2a('0x2e')]();};}function respondWithResult(_0x503a87,_0x57e1d3){_0x57e1d3=_0x57e1d3||0xc8;return function(_0x567a5d){if(_0x567a5d){return _0x503a87[_0x0a2a('0x2d')](_0x57e1d3)[_0x0a2a('0x2f')](_0x567a5d);}};}function respondWithFilteredResult(_0x33f568,_0x115236){return function(_0x499649){if(_0x499649){var _0x3cbb58=typeof _0x115236['offset']===_0x0a2a('0x30')&&typeof _0x115236[_0x0a2a('0x31')]==='undefined';var _0x33f076=_0x499649['count'];var _0x1d10c6=_0x3cbb58?0x0:_0x115236['offset'];var _0x4a6171=_0x3cbb58?_0x499649[_0x0a2a('0x32')]:_0x115236[_0x0a2a('0x33')]+_0x115236[_0x0a2a('0x31')];var _0x18ba23;if(_0x4a6171>=_0x33f076){_0x4a6171=_0x33f076;_0x18ba23=0xc8;}else{_0x18ba23=0xce;}_0x33f568[_0x0a2a('0x2d')](_0x18ba23);return _0x33f568['set']('Content-Range',_0x1d10c6+'-'+_0x4a6171+'/'+_0x33f076)[_0x0a2a('0x2f')](_0x499649);}return null;};}function patchUpdates(_0x454d53){return function(_0x1877f2){try{jsonpatch[_0x0a2a('0x34')](_0x1877f2,_0x454d53,!![]);}catch(_0x5d80dd){return BPromise[_0x0a2a('0x35')](_0x5d80dd);}return _0x1877f2[_0x0a2a('0x36')]();};}function saveUpdates(_0x3ae830,_0x55c5aa){return function(_0x6fb489){if(_0x6fb489){return _0x6fb489[_0x0a2a('0x37')](_0x3ae830)[_0x0a2a('0x38')](function(_0x2ed826){return _0x2ed826;});}return null;};}function removeEntity(_0x288f03,_0x1bce0e){return function(_0x2c8b22){if(_0x2c8b22){return _0x2c8b22[_0x0a2a('0x39')]()[_0x0a2a('0x38')](function(){var _0x144ce5=_0x2c8b22['get']({'plain':!![]});var _0x21c3e1='FaxAccounts';return db[_0x0a2a('0x3a')][_0x0a2a('0x39')]({'where':{'type':_0x21c3e1,'resourceId':_0x144ce5['id']}})['then'](function(){return _0x2c8b22;});})['then'](function(){_0x288f03[_0x0a2a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4de383,_0x153495){return function(_0x2df0e5){if(!_0x2df0e5){_0x4de383[_0x0a2a('0x3b')](0x194);}return _0x2df0e5;};}function handleError(_0x3bc7d1,_0x471be9){_0x471be9=_0x471be9||0x1f4;return function(_0x8165e2){logger[_0x0a2a('0x29')](_0x8165e2[_0x0a2a('0x3c')]);if(_0x8165e2['name']){delete _0x8165e2[_0x0a2a('0x3d')];}_0x3bc7d1[_0x0a2a('0x2d')](_0x471be9)['send'](_0x8165e2);};}exports['index']=function(_0x2d1d5f,_0x549fdf){var _0xe2bb96={'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]},_0xa2e10e={},_0x2ce2b4={'count':0x0,'rows':[]};var _0x33ce7e=_['map'](db['FaxAccount']['rawAttributes'],function(_0x56517b){return{'name':_0x56517b[_0x0a2a('0x40')],'type':_0x56517b[_0x0a2a('0x41')]['key']};});_0xa2e10e[_0x0a2a('0x42')]=_[_0x0a2a('0x43')](_0x33ce7e,_0x0a2a('0x3d'));_0xa2e10e[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x2d1d5f['query']);_0xa2e10e[_0x0a2a('0x46')]=_[_0x0a2a('0x47')](_0xa2e10e[_0x0a2a('0x42')],_0xa2e10e[_0x0a2a('0x44')]);_0xe2bb96['attributes']=_['intersection'](_0xa2e10e[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0xe2bb96[_0x0a2a('0x49')]=_0xe2bb96['attributes']['length']?_0xe2bb96[_0x0a2a('0x49')]:_0xa2e10e[_0x0a2a('0x42')];if(!_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0xe2bb96[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x2d1d5f['query'][_0x0a2a('0x31')]);_0xe2bb96[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x2d1d5f[_0x0a2a('0x44')]['offset']);}_0xe2bb96[_0x0a2a('0x4b')]=qs[_0x0a2a('0x4c')](_0x2d1d5f['query'][_0x0a2a('0x4c')]);_0xe2bb96['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x2d1d5f[_0x0a2a('0x44')],_0xa2e10e[_0x0a2a('0x46')]),_0x33ce7e);if(_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0xe2bb96[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0xe2bb96[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x33ce7e,function(_0x1d3bff){if(_0x1d3bff[_0x0a2a('0x41')]!==_0x0a2a('0x51')){var _0x2cf5c7={};_0x2cf5c7[_0x1d3bff['name']]={'$like':'%'+_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x2cf5c7;}})});}_0xe2bb96=_[_0x0a2a('0x50')]({},_0xe2bb96,_0x2d1d5f[_0x0a2a('0x52')]);var _0x3600ff={'where':_0xe2bb96[_0x0a2a('0x4f')]};return db[_0x0a2a('0x53')][_0x0a2a('0x32')](_0x3600ff)['then'](function(_0x3071c1){_0x2ce2b4[_0x0a2a('0x32')]=_0x3071c1;if(_0x2d1d5f['query'][_0x0a2a('0x54')]){_0xe2bb96['include']=[{'all':!![]}];}return db['FaxAccount'][_0x0a2a('0x55')](_0xe2bb96);})[_0x0a2a('0x38')](function(_0x336294){_0x2ce2b4['rows']=_0x336294;return _0x2ce2b4;})[_0x0a2a('0x38')](respondWithFilteredResult(_0x549fdf,_0xe2bb96))['catch'](handleError(_0x549fdf,null));};exports[_0x0a2a('0x56')]=function(_0x5c1b3b,_0xd9d15a){var _0x35dc54={'raw':![],'where':{'id':_0x5c1b3b['params']['id']},'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]},_0x3a182d={};_0x3a182d[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['FaxAccount']['rawAttributes']);_0x3a182d[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x5c1b3b[_0x0a2a('0x44')]);_0x3a182d[_0x0a2a('0x46')]=_['intersection'](_0x3a182d[_0x0a2a('0x42')],_0x3a182d[_0x0a2a('0x44')]);_0x35dc54['attributes']=_[_0x0a2a('0x47')](_0x3a182d[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x5c1b3b['query']['fields']));_0x35dc54[_0x0a2a('0x49')]=_0x35dc54['attributes']['length']?_0x35dc54[_0x0a2a('0x49')]:_0x3a182d['model'];if(_0x5c1b3b['query'][_0x0a2a('0x54')]){_0x35dc54[_0x0a2a('0x57')]=[{'all':!![]}];}_0x35dc54=_[_0x0a2a('0x50')]({},_0x35dc54,_0x5c1b3b['options']);return db[_0x0a2a('0x53')]['find'](_0x35dc54)[_0x0a2a('0x38')](handleEntityNotFound(_0xd9d15a,null))[_0x0a2a('0x38')](respondWithResult(_0xd9d15a,null))[_0x0a2a('0x2c')](handleError(_0xd9d15a,null));};exports[_0x0a2a('0x58')]=function(_0x212f49,_0x22739b){return db[_0x0a2a('0x53')][_0x0a2a('0x58')](_0x212f49['body'],{})[_0x0a2a('0x38')](function(_0x520137){var _0x349f8b=_0x212f49[_0x0a2a('0x59')]['get']({'plain':!![]});if(!_0x349f8b)throw new Error(_0x0a2a('0x5a'));if(_0x349f8b['role']===_0x0a2a('0x59')){var _0x25d7df=_0x520137[_0x0a2a('0x5b')]({'plain':!![]});var _0x2a5659=_0x0a2a('0x5c');return db[_0x0a2a('0x5d')][_0x0a2a('0x5e')]({'where':{'name':_0x2a5659,'userProfileId':_0x349f8b['userProfileId']},'raw':!![]})['then'](function(_0x537b24){if(_0x537b24&&_0x537b24['autoAssociation']===0x0){return db[_0x0a2a('0x3a')][_0x0a2a('0x58')]({'name':_0x25d7df['name'],'resourceId':_0x25d7df['id'],'type':_0x537b24[_0x0a2a('0x3d')],'sectionId':_0x537b24['id']},{})[_0x0a2a('0x38')](function(){return _0x520137;});}else{return _0x520137;}})[_0x0a2a('0x2c')](function(_0x4c0616){logger['error'](_0x0a2a('0x5f'),_0x4c0616);throw _0x4c0616;});}return _0x520137;})[_0x0a2a('0x38')](respondWithResult(_0x22739b,0xc9))[_0x0a2a('0x2c')](handleError(_0x22739b,null));};exports[_0x0a2a('0x37')]=function(_0x1d46df,_0x5716b7){if(_0x1d46df[_0x0a2a('0x60')]['id']){delete _0x1d46df[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x1d46df[_0x0a2a('0x61')]['id']},'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]})[_0x0a2a('0x38')](handleEntityNotFound(_0x5716b7,null))[_0x0a2a('0x38')](saveUpdates(_0x1d46df[_0x0a2a('0x60')],null))[_0x0a2a('0x38')](respondWithResult(_0x5716b7,null))[_0x0a2a('0x2c')](handleError(_0x5716b7,null));};exports[_0x0a2a('0x39')]=function(_0x5aa4a9,_0x1ff863){return db['FaxAccount']['find']({'where':{'id':_0x5aa4a9['params']['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1ff863,null))[_0x0a2a('0x38')](removeEntity(_0x1ff863,null))['catch'](handleError(_0x1ff863,null));};exports[_0x0a2a('0x62')]=function(_0x231b93,_0x45988e){return db[_0x0a2a('0x53')][_0x0a2a('0x62')]()[_0x0a2a('0x38')](respondWithResult(_0x45988e,null))[_0x0a2a('0x2c')](handleError(_0x45988e,null));};exports[_0x0a2a('0x63')]=function(_0x32b185,_0x17c81e,_0x26867e){if(_0x32b185[_0x0a2a('0x60')]['id']){delete _0x32b185[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x32b185[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x17c81e,null))[_0x0a2a('0x38')](function(_0x532f52){if(_0x532f52){_0x32b185[_0x0a2a('0x60')][_0x0a2a('0x64')]=_0x532f52['id'];return db[_0x0a2a('0x65')][_0x0a2a('0x58')](_0x32b185['body']);}})[_0x0a2a('0x38')](respondWithResult(_0x17c81e,null))[_0x0a2a('0x2c')](handleError(_0x17c81e,null));};exports[_0x0a2a('0x66')]=function(_0x424ee9,_0x1c8118,_0x40c96e){var _0x4ebac0={'raw':![],'where':{}};var _0x46d686={};var _0x2fab42={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')]['findOne']({'where':{'id':_0x424ee9[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1c8118,null))['then'](function(_0x23311e){if(_0x23311e){_0x46d686[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db[_0x0a2a('0x65')][_0x0a2a('0x67')]);_0x46d686[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x424ee9['query']);_0x46d686[_0x0a2a('0x46')]=_['intersection'](_0x46d686[_0x0a2a('0x42')],_0x46d686[_0x0a2a('0x44')]);_0x4ebac0['attributes']=_[_0x0a2a('0x47')](_0x46d686[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x424ee9[_0x0a2a('0x44')]['fields']));_0x4ebac0['attributes']=_0x4ebac0[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0x4ebac0[_0x0a2a('0x49')]:_0x46d686[_0x0a2a('0x42')];if(!_0x424ee9[_0x0a2a('0x44')]['hasOwnProperty'](_0x0a2a('0x69'))){_0x4ebac0[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x424ee9[_0x0a2a('0x44')][_0x0a2a('0x31')]);_0x4ebac0['offset']=qs[_0x0a2a('0x33')](_0x424ee9[_0x0a2a('0x44')]['offset']);}_0x4ebac0[_0x0a2a('0x4b')]=qs['sort'](_0x424ee9[_0x0a2a('0x44')]['sort']);_0x4ebac0[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x424ee9[_0x0a2a('0x44')],_0x46d686['filters']));_0x4ebac0[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x23311e['id'];if(_0x424ee9[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0x4ebac0['where']=_['merge'](_0x4ebac0[_0x0a2a('0x4f')],{'$or':_['map'](_0x4ebac0[_0x0a2a('0x49')],function(_0x28095e){var _0x27896a={};_0x27896a[_0x28095e]={'$like':'%'+_0x424ee9['query'][_0x0a2a('0x4e')]+'%'};return _0x27896a;})});}_0x4ebac0=_[_0x0a2a('0x50')]({},_0x4ebac0,_0x424ee9['options']);return db[_0x0a2a('0x65')]['count']({'where':_0x4ebac0[_0x0a2a('0x4f')]})['then'](function(_0x51864a){_0x2fab42[_0x0a2a('0x32')]=_0x51864a;if(_0x424ee9['query'][_0x0a2a('0x54')]){_0x4ebac0['include']=[{'all':!![]}];}return db['Disposition'][_0x0a2a('0x55')](_0x4ebac0);})[_0x0a2a('0x38')](function(_0x532c81){_0x2fab42['rows']=_0x532c81;return _0x2fab42;});}})[_0x0a2a('0x38')](respondWithFilteredResult(_0x1c8118,_0x4ebac0))['catch'](handleError(_0x1c8118,null));};exports[_0x0a2a('0x6a')]=function(_0x3094cf,_0x5bcede,_0x556347){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x3094cf[_0x0a2a('0x61')]['id']}})['then'](handleEntityNotFound(_0x5bcede,null))['then'](function(_0x2854a9){if(_0x2854a9){return _0x2854a9[_0x0a2a('0x6a')](_0x3094cf['query'][_0x0a2a('0x6b')]);}})['then'](respondWithStatusCode(_0x5bcede,null))[_0x0a2a('0x2c')](handleError(_0x5bcede,null));};exports[_0x0a2a('0x6c')]=function(_0x260ed0,_0x30eddf,_0x3408cb){if(_0x260ed0['body']['id']){delete _0x260ed0[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x260ed0['params']['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x30eddf,null))[_0x0a2a('0x38')](function(_0x2d5426){if(_0x2d5426){_0x260ed0['body'][_0x0a2a('0x64')]=_0x2d5426['id'];return db[_0x0a2a('0x6d')]['create'](_0x260ed0[_0x0a2a('0x60')]);}})[_0x0a2a('0x38')](respondWithResult(_0x30eddf,null))[_0x0a2a('0x2c')](handleError(_0x30eddf,null));};exports[_0x0a2a('0x6e')]=function(_0x1a85ae,_0xb90dfd,_0x32360f){var _0x19f6d0={'raw':![],'where':{}};var _0x3fe128={};var _0x47022a={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x1a85ae[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0xb90dfd,null))[_0x0a2a('0x38')](function(_0x3603eb){if(_0x3603eb){_0x3fe128[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['CannedAnswer']['rawAttributes']);_0x3fe128['query']=_['keys'](_0x1a85ae[_0x0a2a('0x44')]);_0x3fe128['filters']=_[_0x0a2a('0x47')](_0x3fe128['model'],_0x3fe128[_0x0a2a('0x44')]);_0x19f6d0[_0x0a2a('0x49')]=_['intersection'](_0x3fe128[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x1a85ae['query'][_0x0a2a('0x48')]));_0x19f6d0[_0x0a2a('0x49')]=_0x19f6d0[_0x0a2a('0x49')]['length']?_0x19f6d0[_0x0a2a('0x49')]:_0x3fe128[_0x0a2a('0x42')];if(!_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x19f6d0[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x1a85ae['query']['limit']);_0x19f6d0[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x1a85ae['query'][_0x0a2a('0x33')]);}_0x19f6d0[_0x0a2a('0x4b')]=qs['sort'](_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x19f6d0[_0x0a2a('0x4f')]=qs['filters'](_[_0x0a2a('0x4d')](_0x1a85ae[_0x0a2a('0x44')],_0x3fe128['filters']));_0x19f6d0[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x3603eb['id'];if(_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0x19f6d0[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x19f6d0[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x19f6d0['attributes'],function(_0xc420b1){var _0x472cab={};_0x472cab[_0xc420b1]={'$like':'%'+_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x472cab;})});}_0x19f6d0=_[_0x0a2a('0x50')]({},_0x19f6d0,_0x1a85ae['options']);return db[_0x0a2a('0x6d')][_0x0a2a('0x32')]({'where':_0x19f6d0['where']})[_0x0a2a('0x38')](function(_0x421d44){_0x47022a[_0x0a2a('0x32')]=_0x421d44;if(_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x19f6d0[_0x0a2a('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a2a('0x55')](_0x19f6d0);})[_0x0a2a('0x38')](function(_0x520e18){_0x47022a[_0x0a2a('0x70')]=_0x520e18;return _0x47022a;});}})['then'](respondWithFilteredResult(_0xb90dfd,_0x19f6d0))[_0x0a2a('0x2c')](handleError(_0xb90dfd,null));};exports['removeAnswers']=function(_0x1e5214,_0x2c932a,_0x356358){return db['FaxAccount'][_0x0a2a('0x5e')]({'where':{'id':_0x1e5214[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x2c932a,null))[_0x0a2a('0x38')](function(_0x10359e){if(_0x10359e){return _0x10359e[_0x0a2a('0x71')](_0x1e5214[_0x0a2a('0x44')]['ids']);}})[_0x0a2a('0x38')](respondWithStatusCode(_0x2c932a,null))[_0x0a2a('0x2c')](handleError(_0x2c932a,null));};exports[_0x0a2a('0x72')]=function(_0x5947ab,_0x455fde,_0x453f66){return db[_0x0a2a('0x73')][_0x0a2a('0x5e')]({'where':{'id':_0x5947ab[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x455fde,null))['then'](function(_0x579a1b){if(_0x579a1b){return _0x579a1b[_0x0a2a('0x72')](_0x5947ab[_0x0a2a('0x60')][_0x0a2a('0x6b')],_[_0x0a2a('0x74')](_0x5947ab['body'],[_0x0a2a('0x6b'),'id'])||{});}})[_0x0a2a('0x38')](respondWithResult(_0x455fde,null))[_0x0a2a('0x2c')](handleError(_0x455fde,null));};exports[_0x0a2a('0x75')]=function(_0x3ff6cd,_0xa81e01,_0x5dcaf2){var _0x1b8615={'raw':![],'where':{}};var _0x3af30f={};var _0x68f947={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x3ff6cd[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0xa81e01,null))[_0x0a2a('0x38')](function(_0x8cd24d){if(_0x8cd24d){_0x3af30f['model']=_[_0x0a2a('0x45')](db[_0x0a2a('0x73')]['rawAttributes']);_0x3af30f[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x3ff6cd[_0x0a2a('0x44')]);_0x3af30f[_0x0a2a('0x46')]=_['intersection'](_0x3af30f['model'],_0x3af30f[_0x0a2a('0x44')]);_0x1b8615[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x3af30f['model'],qs['fields'](_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0x1b8615[_0x0a2a('0x49')]=_0x1b8615[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0x1b8615['attributes']:_0x3af30f[_0x0a2a('0x42')];if(!_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x1b8615[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x3ff6cd['query'][_0x0a2a('0x31')]);_0x1b8615['offset']=qs[_0x0a2a('0x33')](_0x3ff6cd['query'][_0x0a2a('0x33')]);}_0x1b8615[_0x0a2a('0x4b')]=qs['sort'](_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x1b8615['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x3ff6cd['query'],_0x3af30f['filters']));_0x1b8615['where'][_0x0a2a('0x64')]=_0x8cd24d['id'];if(_0x3ff6cd[_0x0a2a('0x44')]['filter']){_0x1b8615[_0x0a2a('0x4f')]=_['merge'](_0x1b8615['where'],{'$or':_[_0x0a2a('0x43')](_0x1b8615[_0x0a2a('0x49')],function(_0x96cb38){var _0x42bac2={};_0x42bac2[_0x96cb38]={'$like':'%'+_0x3ff6cd['query']['filter']+'%'};return _0x42bac2;})});}_0x1b8615=_[_0x0a2a('0x50')]({},_0x1b8615,_0x3ff6cd[_0x0a2a('0x52')]);return db[_0x0a2a('0x73')][_0x0a2a('0x32')]({'where':_0x1b8615[_0x0a2a('0x4f')]})[_0x0a2a('0x38')](function(_0x2989b3){_0x68f947[_0x0a2a('0x32')]=_0x2989b3;if(_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x1b8615[_0x0a2a('0x57')]=[{'model':db[_0x0a2a('0x76')],'as':_0x0a2a('0x77'),'required':![]},{'model':db[_0x0a2a('0x78')],'as':_0x0a2a('0x79'),'attributes':[_0x0a2a('0x3d'),_0x0a2a('0x7a'),_0x0a2a('0x7b')],'required':![]},{'model':db[_0x0a2a('0x7c')],'as':_0x0a2a('0x7d'),'attributes':['id',_0x0a2a('0x3d'),'color'],'where':_0x3ff6cd['query']['tag']?{'id':_0x3ff6cd[_0x0a2a('0x44')]['tag']}:undefined,'required':_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x7e')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x1b8615);})[_0x0a2a('0x38')](function(_0x188ba5){_0x68f947[_0x0a2a('0x70')]=_0x188ba5;return _0x68f947;});}})['then'](respondWithFilteredResult(_0xa81e01,_0x1b8615))[_0x0a2a('0x2c')](handleError(_0xa81e01,null));};exports['addApplications']=function(_0x14ff9f,_0x330277){var _0x18ca16=_0x14ff9f['params']['id'];var _0x58a6c7=_0x14ff9f[_0x0a2a('0x60')];var _0x288ed7=0xc8;var _0x6d0cb7=null;return db['sequelize'][_0x0a2a('0x7f')]({'isolationLevel':db[_0x0a2a('0x80')]['Transaction'][_0x0a2a('0x81')][_0x0a2a('0x82')]},function(_0x1e3a84){return db[_0x0a2a('0x53')]['findOne']({'where':{'id':_0x18ca16},'transaction':_0x1e3a84})['then'](function(_0x25acc0){if(_0x25acc0){return db['FaxApplication'][_0x0a2a('0x39')]({'where':{'FaxAccountId':_0x18ca16},'transaction':_0x1e3a84})[_0x0a2a('0x38')](function(){var _0x2da351=_[_0x0a2a('0x43')](_0x58a6c7,function(_0x17895d){_0x17895d[_0x0a2a('0x64')]=_0x18ca16;return _0x17895d;});return db['FaxApplication']['bulkCreate'](_0x2da351,{'transaction':_0x1e3a84});});}else{_0x288ed7=0x194;_0x6d0cb7=[];}});})[_0x0a2a('0x38')](function(){if(_0x288ed7!==0x194){return db[_0x0a2a('0x83')][_0x0a2a('0x84')]({'where':{'FaxAccountId':_0x18ca16},'order':_0x0a2a('0x85')})[_0x0a2a('0x38')](function(_0x2407f3){_0x6d0cb7=_0x2407f3;});}})['catch'](function(_0x1d9742){_0x288ed7=0x1f4;logger[_0x0a2a('0x29')](_0x1d9742['stack']);if(_0x1d9742[_0x0a2a('0x3d')]){delete _0x1d9742[_0x0a2a('0x3d')];}_0x6d0cb7=_0x1d9742;})[_0x0a2a('0x86')](function(){if(_0x6d0cb7===null){_0x330277[_0x0a2a('0x3b')](_0x288ed7);}else{if(_0x288ed7===0x1f4){_0x330277['status'](_0x288ed7)[_0x0a2a('0x87')](_0x6d0cb7);}else{_0x330277[_0x0a2a('0x2d')](_0x288ed7)[_0x0a2a('0x2f')](_0x6d0cb7);}}});};exports['getApplications']=function(_0x18baa5,_0x5eff23,_0x6ad9ce){var _0xd255c7={};var _0x59cc2c={};var _0x4c112d;var _0x39f7a5;return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x18baa5[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x5eff23,null))[_0x0a2a('0x38')](function(_0x5b7300){if(_0x5b7300){_0x4c112d=_0x5b7300;_0x59cc2c[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['FaxApplication'][_0x0a2a('0x67')]);_0x59cc2c['query']=_[_0x0a2a('0x45')](_0x18baa5['query']);_0x59cc2c[_0x0a2a('0x46')]=_['intersection'](_0x59cc2c[_0x0a2a('0x42')],_0x59cc2c[_0x0a2a('0x44')]);_0xd255c7[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x59cc2c[_0x0a2a('0x42')],qs['fields'](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0xd255c7['attributes']=_0xd255c7[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0xd255c7['attributes']:_0x59cc2c[_0x0a2a('0x42')];_0xd255c7[_0x0a2a('0x4b')]=qs['sort'](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0xd255c7[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x18baa5['query'],_0x59cc2c[_0x0a2a('0x46')]));if(_0x18baa5[_0x0a2a('0x44')]['filter']){_0xd255c7['where']=_['merge'](_0xd255c7[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0xd255c7['attributes'],function(_0x20b979){var _0x1ccec0={};_0x1ccec0[_0x20b979]={'$like':'%'+_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x1ccec0;})});}_0xd255c7=_[_0x0a2a('0x50')]({},_0xd255c7,_0x18baa5[_0x0a2a('0x52')]);return _0x4c112d[_0x0a2a('0x88')](_0xd255c7);}})[_0x0a2a('0x38')](function(_0xb60b99){if(_0xb60b99){_0x39f7a5=_0xb60b99[_0x0a2a('0x68')];if(!_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0xd255c7[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x18baa5['query']['limit']);_0xd255c7[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x33')]);}return _0x4c112d[_0x0a2a('0x88')](_0xd255c7);}})['then'](function(_0x4d91f7){if(_0x4d91f7){return _0x4d91f7?{'count':_0x39f7a5,'rows':_0x4d91f7}:null;}})[_0x0a2a('0x38')](respondWithResult(_0x5eff23,null))[_0x0a2a('0x2c')](handleError(_0x5eff23,null));};function Extension(_0x94d8ed,_0x2c40cf,_0x890ca9,_0x3a6ed2){this[_0x0a2a('0x89')]=_0x0a2a('0x8a');this[_0x0a2a('0x8b')]=_0x94d8ed['localstationid'];this[_0x0a2a('0x8c')]=_0x3a6ed2;this[_0x0a2a('0x41')]=_0x0a2a('0x8d');this[_0x0a2a('0x8e')]=_0x0a2a('0x8f');this[_0x0a2a('0x64')]=_0x94d8ed['id'];this['priority']=_0x2c40cf;this['appdata']=_0x890ca9;}function createExtensionsReciveFax(_0x1d8144){var _0xf20bb8=0x1;var _0x250f75=[];_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'',_0x0a2a('0x91')));_0xf20bb8+=0x1;_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'CDR(type)=inbound-fax',_0x0a2a('0x92')));_0xf20bb8+=0x1;for(var _0x2a1b38 in _0x1d8144){if(_0x1d8144[_0x0a2a('0x4a')](_0x2a1b38)&&(_0x2a1b38===_0x0a2a('0x93')||_0x2a1b38===_0x0a2a('0x94')||_0x2a1b38===_0x0a2a('0x95')||_0x2a1b38===_0x0a2a('0x96')||_0x2a1b38===_0x0a2a('0x97')||_0x2a1b38==='maxrate'||_0x2a1b38===_0x0a2a('0x98')||_0x2a1b38===_0x0a2a('0x99')||_0x2a1b38===_0x0a2a('0x9a'))){_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'FAXOPT('+_0x2a1b38+')='+_0x1d8144[_0x2a1b38],_0x0a2a('0x92')));_0xf20bb8+=0x1;}}_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'6',_0x0a2a('0x9b')));_0xf20bb8+=0x1;_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,_0x0a2a('0x9c'),'ReceiveFax'));_0xf20bb8=0x0;return _0x250f75;}exports['addAccountApplications']=function(_0xb216ea,_0x6cc46e,_0x3044ef){var _0x1fdb52;return db['sequelize'][_0x0a2a('0x7f')](function(_0x34f0fe){return db['FaxAccount'][_0x0a2a('0x58')](_0xb216ea[_0x0a2a('0x60')],{'transaction':_0x34f0fe})['then'](function(_0x4e95de){_0x1fdb52=_0x4e95de['get']({'plain':!![]});return db[_0x0a2a('0x9d')][_0x0a2a('0x9e')](createExtensionsReciveFax(_0x1fdb52),{'transaction':_0x34f0fe});});})[_0x0a2a('0x38')](function(){return _0x1fdb52;})[_0x0a2a('0x38')](respondWithResult(_0x6cc46e,null))[_0x0a2a('0x2c')](handleError(_0x6cc46e,null));};exports['updateAccountApplications']=function(_0x5e2310,_0x1eefd4,_0x6e7422){var _0x3302f2;return db[_0x0a2a('0x80')][_0x0a2a('0x7f')](function(_0x43c81b){return db[_0x0a2a('0x53')][_0x0a2a('0x37')](_0x5e2310['body'],{'where':{'id':_0x5e2310[_0x0a2a('0x60')]['id']},'transaction':_0x43c81b})['then'](function(_0x40a1f7){return db[_0x0a2a('0x9d')][_0x0a2a('0x39')]({'where':{'FaxAccountId':_0x5e2310['body']['id']},'transaction':_0x43c81b})[_0x0a2a('0x38')](function(_0x2f7895){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x0a2a('0x74')](_0x5e2310[_0x0a2a('0x60')],[_0x0a2a('0x9f'),'key',_0x0a2a('0xa0'),_0x0a2a('0xa1'),_0x0a2a('0xa2'),_0x0a2a('0xa3')])),{'transaction':_0x43c81b});});});})[_0x0a2a('0x38')](function(){return db[_0x0a2a('0x53')]['findById'](_0x5e2310[_0x0a2a('0x60')]['id']);})['then'](respondWithResult(_0x1eefd4,null))[_0x0a2a('0x2c')](handleError(_0x1eefd4,null));};exports[_0x0a2a('0xa4')]=function(_0x5b9bb2,_0x377a2e,_0x101374){var _0x428a25={'raw':!![],'where':{}};var _0x1773a6={};var _0x1abaac={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x5b9bb2[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x377a2e,null))[_0x0a2a('0x38')](function(_0x192f63){if(_0x192f63){_0x1773a6[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db[_0x0a2a('0xa5')]['rawAttributes']);_0x1773a6[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x5b9bb2[_0x0a2a('0x44')]);_0x1773a6['filters']=_[_0x0a2a('0x47')](_0x1773a6['model'],_0x1773a6[_0x0a2a('0x44')]);_0x428a25[_0x0a2a('0x49')]=_['intersection'](_0x1773a6[_0x0a2a('0x42')],qs['fields'](_0x5b9bb2['query'][_0x0a2a('0x48')]));_0x428a25[_0x0a2a('0x49')]=_0x428a25[_0x0a2a('0x49')]['length']?_0x428a25['attributes']:_0x1773a6[_0x0a2a('0x42')];if(!_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0x428a25['limit']=qs[_0x0a2a('0x31')](_0x5b9bb2[_0x0a2a('0x44')]['limit']);_0x428a25[_0x0a2a('0x33')]=qs['offset'](_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x33')]);}_0x428a25['order']=qs[_0x0a2a('0x4c')](_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x428a25['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x5b9bb2[_0x0a2a('0x44')],_0x1773a6[_0x0a2a('0x46')]));_0x428a25[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x192f63['id'];if(_0x5b9bb2['query'][_0x0a2a('0x4e')]){_0x428a25[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x428a25['where'],{'$or':_['map'](_0x428a25[_0x0a2a('0x49')],function(_0x1851d5){var _0x5c9972={};_0x5c9972[_0x1851d5]={'$like':'%'+_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x5c9972;})});}if(_0x5b9bb2[_0x0a2a('0x44')]['$gte']){var _0x598b0f=_0x5b9bb2['query'][_0x0a2a('0xa6')]['split'](',');var _0x39c330={};_0x39c330[_0x598b0f[0x0]]={'$gte':moment(_0x598b0f[0x1])[_0x0a2a('0xa7')](_0x0a2a('0xa8'))};_0x428a25[_0x0a2a('0x4f')]=_['merge'](_0x428a25[_0x0a2a('0x4f')],_0x39c330);}_0x428a25=_[_0x0a2a('0x50')]({},_0x428a25,_0x5b9bb2[_0x0a2a('0x52')]);return db[_0x0a2a('0xa5')][_0x0a2a('0x32')]({'where':_0x428a25[_0x0a2a('0x4f')]})[_0x0a2a('0x38')](function(_0x1c3f3d){_0x1abaac[_0x0a2a('0x32')]=_0x1c3f3d;if(_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x428a25[_0x0a2a('0x57')]=[{'all':!![]}];}return db[_0x0a2a('0xa5')][_0x0a2a('0x55')](_0x428a25);})[_0x0a2a('0x38')](function(_0x3d4e57){_0x1abaac[_0x0a2a('0x70')]=_0x3d4e57;return _0x1abaac;});}})['then'](respondWithFilteredResult(_0x377a2e,_0x428a25))[_0x0a2a('0x2c')](handleError(_0x377a2e,null));};exports[_0x0a2a('0x87')]=function(_0x2ae1fe,_0x4eb1fd,_0x13b71b){var _0x1f0af0,_0x32822a={},_0xf6332e;if(_0x2ae1fe[_0x0a2a('0x60')]['to']){_0xf6332e=_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0];}return db[_0x0a2a('0x53')]['find']({'where':{'id':_0x2ae1fe['params']['id']},'include':[{'model':db[_0x0a2a('0xa9')],'as':'List','include':[{'model':db[_0x0a2a('0x76')],'as':'Contacts','where':{'fax':_0xf6332e},'limit':0x1,'order':[[_0x0a2a('0xa1'),_0x0a2a('0xaa')]]}]}]})[_0x0a2a('0x38')](handleEntityNotFound(_0x4eb1fd,null))[_0x0a2a('0x38')](function(_0x4ebd49){_0x1f0af0=_0x4ebd49;if(_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')]&&_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x0a2a('0x68')]){for(var _0x38c2de=0x0;_0x38c2de<_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x0a2a('0x68')];_0x38c2de+=0x1){_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]={'filename':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x38c2de][_0x0a2a('0x3d')],'id':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]['id'],'path':path[_0x0a2a('0xac')](config[_0x0a2a('0xad')],_0x0a2a('0xae'),_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]['basename'])};}}return respondWithRpcPromise(_0x0a2a('0xaf'),_0x0a2a('0xaf'),{'FaxAccountId':_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x61')]['id'])?undefined:_0x2ae1fe[_0x0a2a('0x61')]['id'],'path':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0][_0x0a2a('0x9')])?undefined:_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0][_0x0a2a('0x9')],'fax':_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0])?undefined:_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x1f0af0){if(_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xb1')])){_0x2ae1fe[_0x0a2a('0x60')]['from']=util[_0x0a2a('0xa7')](_0x0a2a('0xb2'),_0x1f0af0['name'],_0x1f0af0[_0x0a2a('0xb3')]);}if(_0x1f0af0[_0x0a2a('0xb4')]){if(_0x1f0af0['List'][_0x0a2a('0xb5')][_0x0a2a('0x68')]){return _0x1f0af0['List'][_0x0a2a('0xb5')][0x0];}else{return db[_0x0a2a('0x76')][_0x0a2a('0x58')](_[_0x0a2a('0x1b')](_0x2ae1fe[_0x0a2a('0x60')],{'firstName':_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0],'phone':_0x2ae1fe['body']['to'][0x0],'fax':_0x2ae1fe['body']['to'][0x0],'ListId':_0x1f0af0['ListId']}));}}else{throw new Error(_0x0a2a('0xb6'));}}else{throw new Error(_0x0a2a('0xb7'));}})[_0x0a2a('0x38')](function(_0x4d602b){if(_0x4d602b){return db['FaxInteraction']['find']({'where':{'ContactId':_0x4d602b['id'],'closed':![],'FaxAccountId':_0x1f0af0['id']}})[_0x0a2a('0x38')](function(_0x4e490f){if(_0x4e490f){return[_0x4e490f,![]];}return db[_0x0a2a('0x73')][_0x0a2a('0x58')]({'UserId':_0x2ae1fe[_0x0a2a('0x59')]['id'],'ContactId':_0x4d602b['id'],'FaxAccountId':_0x1f0af0['id'],'fax':_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0],'firstMsgDirection':_0x0a2a('0xb8'),'Messages':[_[_0x0a2a('0x50')](_0x2ae1fe[_0x0a2a('0x60')],{'read':![],'body':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['filename'],'FaxAccountId':_0x1f0af0['id'],'UserId':_0x2ae1fe['user']['id'],'ContactId':_0x4d602b['id'],'AttachmentId':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x0a2a('0x38')](function(_0x435642){return[_0x435642,!![]];});});}else{throw new Error(_0x0a2a('0xb9'));}})[_0x0a2a('0xba')](function(_0x462b34,_0x400017){if(_0x400017){return _0x462b34;}return db[_0x0a2a('0xa5')][_0x0a2a('0x58')]({'direction':_0x0a2a('0xb8'),'read':![],'body':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['filename'],'FaxAccountId':_0x1f0af0['id'],'FaxInteractionId':_0x462b34['id'],'UserId':_0x2ae1fe['user']['id'],'ContactId':_0x462b34[_0x0a2a('0xbb')],'AttachmentId':_0x2ae1fe['body']['attachments'][0x0]['id']})[_0x0a2a('0x38')](function(_0x4e0790){_0x462b34[_0x0a2a('0xbc')]['Messages']=[];_0x462b34[_0x0a2a('0xbc')][_0x0a2a('0xbd')]['push'](_0x4e0790[_0x0a2a('0xbc')]);return _0x462b34;});})[_0x0a2a('0x38')](function(_0x11a91a){respondWithRpcPromise(_0x0a2a('0xbe'),_0x0a2a('0xbe'),{'FaxAccountId':_['isNil'](_0x2ae1fe['params']['id'])?undefined:_0x2ae1fe[_0x0a2a('0x61')]['id'],'path':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0][_0x0a2a('0x9')])?undefined:_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['path'],'fax':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0])?undefined:_0x2ae1fe['body']['to'][0x0],'AttachmentId':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0]['id']},client9002)[_0x0a2a('0x38')](function(_0xbaf449){logger[_0x0a2a('0x25')](_0x0a2a('0xbf'),_0xbaf449);})[_0x0a2a('0x2c')](function(_0x3b1e67){logger[_0x0a2a('0x25')](_0x0a2a('0xbf'),_0x3b1e67);});return _0x11a91a;})['then'](respondWithResult(_0x4eb1fd,null))[_0x0a2a('0x2c')](handleError(_0x4eb1fd,null));};exports['addAgents']=function(_0xcae871,_0x1c0b6f,_0x11be07){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0xcae871[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1c0b6f,null))[_0x0a2a('0x38')](function(_0x1641c6){if(_0x1641c6){return _0x1641c6[_0x0a2a('0xc0')](_0xcae871['body'][_0x0a2a('0x6b')],_['omit'](_0xcae871[_0x0a2a('0x60')],[_0x0a2a('0x6b'),'id'])||{})[_0x0a2a('0xba')](function(_0x17ebbe){for(var _0x556067=0x0;_0x556067<_0xcae871[_0x0a2a('0x60')]['ids'][_0x0a2a('0x68')];_0x556067+=0x1){socket[_0x0a2a('0xc1')](_0x0a2a('0xc2'),{'UserId':Number(_0xcae871[_0x0a2a('0x60')][_0x0a2a('0x6b')][_0x556067]),'FaxAccountId':Number(_0xcae871[_0x0a2a('0x61')]['id'])});}return _0x17ebbe;});}})[_0x0a2a('0x38')](respondWithResult(_0x1c0b6f,null))[_0x0a2a('0x2c')](handleError(_0x1c0b6f,null));};exports[_0x0a2a('0xc3')]=function(_0x385152,_0xbaba01,_0x5618a9){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x385152['params']['id']}})['then'](handleEntityNotFound(_0xbaba01,null))[_0x0a2a('0x38')](function(_0x79d06b){if(_0x79d06b){return _0x79d06b['removeAgents'](_0x385152['query']['ids'])[_0x0a2a('0x38')](function(){if(_['isArray'](_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')])){for(var _0x56568b=0x0;_0x56568b<_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')][_0x0a2a('0x68')];_0x56568b+=0x1){socket[_0x0a2a('0xc1')](_0x0a2a('0xc4'),{'UserId':Number(_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')][_0x56568b]),'FaxAccountId':Number(_0x385152[_0x0a2a('0x61')]['id'])});}}else{socket[_0x0a2a('0xc1')](_0x0a2a('0xc4'),{'UserId':Number(_0x385152['query'][_0x0a2a('0x6b')]),'FaxAccountId':Number(_0x385152['params']['id'])});}});}})[_0x0a2a('0x38')](respondWithStatusCode(_0xbaba01,null))[_0x0a2a('0x2c')](handleError(_0xbaba01,null));};exports[_0x0a2a('0xc5')]=function(_0x9f8a4c,_0x350ed8,_0x129484){var _0x3e4a07={};var _0x3ce4f1={};var _0x4900df;var _0x2087f6;return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x9f8a4c[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x350ed8,null))[_0x0a2a('0x38')](function(_0x3294ec){if(_0x3294ec){_0x4900df=_0x3294ec;_0x3ce4f1[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['User'][_0x0a2a('0x67')]);_0x3ce4f1[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x9f8a4c[_0x0a2a('0x44')]);_0x3ce4f1[_0x0a2a('0x46')]=_[_0x0a2a('0x47')](_0x3ce4f1['model'],_0x3ce4f1['query']);_0x3e4a07[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x3ce4f1['model'],qs[_0x0a2a('0x48')](_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0x3e4a07[_0x0a2a('0x49')]=_0x3e4a07[_0x0a2a('0x49')]['length']?_0x3e4a07[_0x0a2a('0x49')]:_0x3ce4f1['model'];_0x3e4a07[_0x0a2a('0x4b')]=qs[_0x0a2a('0x4c')](_0x9f8a4c['query'][_0x0a2a('0x4c')]);_0x3e4a07[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x9f8a4c['query'],_0x3ce4f1[_0x0a2a('0x46')]));if(_0x9f8a4c[_0x0a2a('0x44')]['filter']){_0x3e4a07[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x3e4a07[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x3e4a07[_0x0a2a('0x49')],function(_0x176a75){var _0x26adfe={};_0x26adfe[_0x176a75]={'$like':'%'+_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x26adfe;})});}_0x3e4a07=_[_0x0a2a('0x50')]({},_0x3e4a07,_0x9f8a4c['options']);return _0x4900df[_0x0a2a('0xc5')](_0x3e4a07);}})[_0x0a2a('0x38')](function(_0x271d69){if(_0x271d69){_0x2087f6=_0x271d69[_0x0a2a('0x68')];if(!_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x3e4a07[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x31')]);_0x3e4a07[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x9f8a4c['query'][_0x0a2a('0x33')]);}return _0x4900df[_0x0a2a('0xc5')](_0x3e4a07);}})[_0x0a2a('0x38')](function(_0x5bb344){if(_0x5bb344){return _0x5bb344?{'count':_0x2087f6,'rows':_0x5bb344}:null;}})['then'](respondWithResult(_0x350ed8,null))[_0x0a2a('0x2c')](handleError(_0x350ed8,null));};
\ No newline at end of file