Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / voicePrefix / voicePrefix.controller.js
index b50586b..4a04919 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff24=['catch','params','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','User','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voicePrefix.socket','register','sendStatus','status','offset','limit','set','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','end','error','stack','name','index','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','VoicePrefix','count','includeAll','rows'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xff24,0xa6));var _0x4ff2=function(_0x5934eb,_0x20167a){_0x5934eb=_0x5934eb-0x0;var _0xf5f2f6=_0xff24[_0x5934eb];return _0xf5f2f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ff2('0x0'));var zipdir=require(_0x4ff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ff2('0x2'));var Mustache=require(_0x4ff2('0x3'));var util=require(_0x4ff2('0x4'));var path=require(_0x4ff2('0x5'));var sox=require(_0x4ff2('0x6'));var csv=require(_0x4ff2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ff2('0x8'));var squel=require(_0x4ff2('0x9'));var crypto=require(_0x4ff2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4ff2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ff2('0xc'));var Redis=require(_0x4ff2('0xd'));var authService=require(_0x4ff2('0xe'));var qs=require(_0x4ff2('0xf'));var as=require(_0x4ff2('0x10'));var hardwareService=require(_0x4ff2('0x11'));var logger=require(_0x4ff2('0x12'))(_0x4ff2('0x13'));var utils=require('../../config/utils');var config=require(_0x4ff2('0x14'));var db=require(_0x4ff2('0x15'))['db'];config[_0x4ff2('0x16')]=_[_0x4ff2('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ff2('0x16')]));require(_0x4ff2('0x18'))[_0x4ff2('0x19')](socket);function respondWithStatusCode(_0x2aa440,_0xc2e081){_0xc2e081=_0xc2e081||0xcc;return function(_0x383e4e){if(_0x383e4e){return _0x2aa440[_0x4ff2('0x1a')](_0xc2e081);}return _0x2aa440[_0x4ff2('0x1b')](_0xc2e081)['end']();};}function respondWithResult(_0x1eba42,_0xb5dd63){_0xb5dd63=_0xb5dd63||0xc8;return function(_0x540438){if(_0x540438){return _0x1eba42[_0x4ff2('0x1b')](_0xb5dd63)['json'](_0x540438);}};}function respondWithFilteredResult(_0x5b19d9,_0x5b9bc7){return function(_0x613fac){if(_0x613fac){var _0x4eb779=_0x613fac['count'],_0x1011d1=_0x5b9bc7[_0x4ff2('0x1c')],_0xf9900=_0x5b9bc7[_0x4ff2('0x1c')]+_0x5b9bc7[_0x4ff2('0x1d')],_0x72dbf9;if(_0xf9900>=_0x4eb779){_0xf9900=_0x4eb779;_0x72dbf9=0xc8;}else{_0x72dbf9=0xce;}_0x5b19d9[_0x4ff2('0x1b')](_0x72dbf9);return _0x5b19d9[_0x4ff2('0x1e')]('Content-Range',_0x1011d1+'-'+_0xf9900+'/'+_0x4eb779)['json'](_0x613fac);}return null;};}function patchUpdates(_0x4c6052){return function(_0x3f3b4f){try{jsonpatch[_0x4ff2('0x1f')](_0x3f3b4f,_0x4c6052,!![]);}catch(_0x191eb7){return BPromise[_0x4ff2('0x20')](_0x191eb7);}return _0x3f3b4f[_0x4ff2('0x21')]();};}function saveUpdates(_0x400f83,_0xb92773){return function(_0x4d4249){if(_0x4d4249){return _0x4d4249[_0x4ff2('0x22')](_0x400f83)['then'](function(_0x3c24d5){return _0x3c24d5;});}return null;};}function removeEntity(_0x27dab5,_0x202c5c){return function(_0x362b7f){if(_0x362b7f){return _0x362b7f[_0x4ff2('0x23')]()['then'](function(){var _0x30ee5d=_0x362b7f[_0x4ff2('0x24')]({'plain':!![]});var _0x312e31=_0x4ff2('0x25');return db[_0x4ff2('0x26')][_0x4ff2('0x23')]({'where':{'type':_0x312e31,'resourceId':_0x30ee5d['id']}})[_0x4ff2('0x27')](function(){return _0x362b7f;});})[_0x4ff2('0x27')](function(){_0x27dab5[_0x4ff2('0x1b')](0xcc)[_0x4ff2('0x28')]();});}};}function handleEntityNotFound(_0x16ecf2,_0x267d8d){return function(_0x27e8fd){if(!_0x27e8fd){_0x16ecf2[_0x4ff2('0x1a')](0x194);}return _0x27e8fd;};}function handleError(_0x35f070,_0x311a6f){_0x311a6f=_0x311a6f||0x1f4;return function(_0x4558c3){logger[_0x4ff2('0x29')](_0x4558c3[_0x4ff2('0x2a')]);if(_0x4558c3[_0x4ff2('0x2b')]){delete _0x4558c3[_0x4ff2('0x2b')];}_0x35f070[_0x4ff2('0x1b')](_0x311a6f)['send'](_0x4558c3);};}exports[_0x4ff2('0x2c')]=function(_0x21edc9,_0x4f0375){var _0x55bb4e={},_0x533350={},_0x177088={'count':0x0,'rows':[]};var _0x2827dc=_[_0x4ff2('0x2d')](db['VoicePrefix'][_0x4ff2('0x2e')],function(_0x180ace){return{'name':_0x180ace['fieldName'],'type':_0x180ace['type']['key']};});_0x533350[_0x4ff2('0x2f')]=_['map'](_0x2827dc,'name');_0x533350[_0x4ff2('0x30')]=_[_0x4ff2('0x31')](_0x21edc9[_0x4ff2('0x30')]);_0x533350[_0x4ff2('0x32')]=_[_0x4ff2('0x33')](_0x533350[_0x4ff2('0x2f')],_0x533350['query']);_0x55bb4e['attributes']=_[_0x4ff2('0x33')](_0x533350[_0x4ff2('0x2f')],qs[_0x4ff2('0x34')](_0x21edc9['query'][_0x4ff2('0x34')]));_0x55bb4e[_0x4ff2('0x35')]=_0x55bb4e[_0x4ff2('0x35')][_0x4ff2('0x36')]?_0x55bb4e['attributes']:_0x533350[_0x4ff2('0x2f')];if(!_0x21edc9['query'][_0x4ff2('0x37')](_0x4ff2('0x38'))){_0x55bb4e[_0x4ff2('0x1d')]=qs[_0x4ff2('0x1d')](_0x21edc9[_0x4ff2('0x30')][_0x4ff2('0x1d')]);_0x55bb4e['offset']=qs[_0x4ff2('0x1c')](_0x21edc9['query'][_0x4ff2('0x1c')]);}_0x55bb4e[_0x4ff2('0x39')]=qs[_0x4ff2('0x3a')](_0x21edc9['query'][_0x4ff2('0x3a')]);_0x55bb4e['where']=qs[_0x4ff2('0x32')](_[_0x4ff2('0x3b')](_0x21edc9['query'],_0x533350[_0x4ff2('0x32')]));if(_0x21edc9[_0x4ff2('0x30')][_0x4ff2('0x3c')]){_0x55bb4e[_0x4ff2('0x3d')]=_[_0x4ff2('0x3e')](_0x55bb4e[_0x4ff2('0x3d')],{'$or':_['map'](_0x2827dc,function(_0xdc70aa){if(_0xdc70aa[_0x4ff2('0x3f')]!==_0x4ff2('0x40')){var _0x515b4e={};_0x515b4e[_0xdc70aa[_0x4ff2('0x2b')]]={'$like':'%'+_0x21edc9['query'][_0x4ff2('0x3c')]+'%'};return _0x515b4e;}})});}_0x55bb4e=_[_0x4ff2('0x3e')]({},_0x55bb4e,_0x21edc9[_0x4ff2('0x41')]);var _0x314145={'where':_0x55bb4e[_0x4ff2('0x3d')]};return db[_0x4ff2('0x42')][_0x4ff2('0x43')](_0x314145)[_0x4ff2('0x27')](function(_0x5c373b){_0x177088[_0x4ff2('0x43')]=_0x5c373b;if(_0x21edc9[_0x4ff2('0x30')][_0x4ff2('0x44')]){_0x55bb4e['include']=[{'all':!![]}];}return db[_0x4ff2('0x42')]['findAll'](_0x55bb4e);})[_0x4ff2('0x27')](function(_0x172441){_0x177088[_0x4ff2('0x45')]=_0x172441;return _0x177088;})[_0x4ff2('0x27')](respondWithFilteredResult(_0x4f0375,_0x55bb4e))[_0x4ff2('0x46')](handleError(_0x4f0375,null));};exports['show']=function(_0x3baaeb,_0x56d650){var _0x39e11a={'raw':![],'where':{'id':_0x3baaeb[_0x4ff2('0x47')]['id']}},_0x5b10e6={};_0x5b10e6[_0x4ff2('0x2f')]=_[_0x4ff2('0x31')](db[_0x4ff2('0x42')][_0x4ff2('0x2e')]);_0x5b10e6[_0x4ff2('0x30')]=_['keys'](_0x3baaeb[_0x4ff2('0x30')]);_0x5b10e6[_0x4ff2('0x32')]=_['intersection'](_0x5b10e6['model'],_0x5b10e6[_0x4ff2('0x30')]);_0x39e11a[_0x4ff2('0x35')]=_['intersection'](_0x5b10e6[_0x4ff2('0x2f')],qs[_0x4ff2('0x34')](_0x3baaeb[_0x4ff2('0x30')][_0x4ff2('0x34')]));_0x39e11a[_0x4ff2('0x35')]=_0x39e11a['attributes'][_0x4ff2('0x36')]?_0x39e11a[_0x4ff2('0x35')]:_0x5b10e6[_0x4ff2('0x2f')];if(_0x3baaeb[_0x4ff2('0x30')]['includeAll']){_0x39e11a[_0x4ff2('0x48')]=[{'all':!![]}];}_0x39e11a=_[_0x4ff2('0x3e')]({},_0x39e11a,_0x3baaeb['options']);return db[_0x4ff2('0x42')][_0x4ff2('0x49')](_0x39e11a)[_0x4ff2('0x27')](handleEntityNotFound(_0x56d650,null))[_0x4ff2('0x27')](respondWithResult(_0x56d650,null))[_0x4ff2('0x46')](handleError(_0x56d650,null));};exports['destroy']=function(_0x239be6,_0x4af616){return db[_0x4ff2('0x42')][_0x4ff2('0x49')]({'where':{'id':_0x239be6['params']['id']}})[_0x4ff2('0x27')](handleEntityNotFound(_0x4af616,null))[_0x4ff2('0x27')](removeEntity(_0x4af616,null))['catch'](handleError(_0x4af616,null));};exports[_0x4ff2('0x4a')]=function(_0x5d4a58,_0x35a9b9){return db[_0x4ff2('0x42')][_0x4ff2('0x4a')]()[_0x4ff2('0x27')](respondWithResult(_0x35a9b9,null))[_0x4ff2('0x46')](handleError(_0x35a9b9,null));};exports[_0x4ff2('0x4b')]=function(_0x37ae7b,_0x504b0f){var _0x3e2e5f;return db[_0x4ff2('0x4c')][_0x4ff2('0x4d')](function(_0xeeb06e){return db[_0x4ff2('0x42')][_0x4ff2('0x4b')](_0x37ae7b[_0x4ff2('0x4e')],{'transaction':_0xeeb06e})[_0x4ff2('0x27')](function(_0x465c08){_0x3e2e5f=_0x465c08[_0x4ff2('0x24')]({'plain':!![]});return db[_0x4ff2('0x4f')][_0x4ff2('0x49')]({'where':{'id':_0x3e2e5f[_0x4ff2('0x50')]},'raw':!![]})[_0x4ff2('0x27')](function(_0x4bbaff){return createVoicePrefixExtensions(_0x3e2e5f,_0x4bbaff,_0xeeb06e);});});})['then'](function(){var _0x35f287=_0x37ae7b[_0x4ff2('0x51')][_0x4ff2('0x24')]({'plain':!![]});if(!_0x35f287)throw new Error(_0x4ff2('0x52'));if(_0x35f287[_0x4ff2('0x53')]===_0x4ff2('0x51')){var _0x59029b=_0x3e2e5f;return db['UserProfileSection']['find']({'where':{'name':_0x4ff2('0x25'),'userProfileId':_0x35f287[_0x4ff2('0x54')]},'raw':!![]})[_0x4ff2('0x27')](function(_0x3b06a4){if(_0x3b06a4&&_0x3b06a4['autoAssociation']===0x0){return db['UserProfileResource'][_0x4ff2('0x4b')]({'name':_0x59029b[_0x4ff2('0x2b')],'resourceId':_0x59029b['id'],'type':_0x3b06a4[_0x4ff2('0x2b')],'sectionId':_0x3b06a4['id']},{})[_0x4ff2('0x27')](function(){return _0x3e2e5f;});}else{return _0x3e2e5f;}})[_0x4ff2('0x46')](function(_0x31f686){logger[_0x4ff2('0x29')](_0x4ff2('0x55'),_0x31f686);throw _0x31f686;});}return _0x3e2e5f;})[_0x4ff2('0x27')](respondWithResult(_0x504b0f,null))[_0x4ff2('0x46')](handleError(_0x504b0f,null));};function Extension(_0x43a1ef,_0x1443e2,_0x4dd425,_0x502924){this[_0x4ff2('0x56')]='from-sip';this['exten']=_0x43a1ef;this[_0x4ff2('0x57')]=_0x4dd425;this['type']=_0x4ff2('0x58');this[_0x4ff2('0x59')]=_0x4ff2('0x5a');this[_0x4ff2('0x5b')]=_0x1443e2;this[_0x4ff2('0x5c')]=_0x502924;}function createVoicePrefixExtensions(_0x231796,_0x267737,_0x135b3a){return new BPromise(function(_0x3d7707,_0x39347b){var _0x2c86c2=new Extension(formatPrefixName(_0x231796[_0x4ff2('0x5d')]),0x1,'NoOp',_0x4ff2('0x5e'));_0x2c86c2[_0x4ff2('0x5f')]=_0x231796['id'];return db[_0x4ff2('0x4f')]['create'](_0x2c86c2,{'transaction':_0x135b3a})['then'](function(_0xfaac8c){var _0x523ecd=_0xfaac8c[_0x4ff2('0x24')]({'plain':!![]});var _0x27ca49=_[_0x4ff2('0x2d')](addVoicePrefixExtensions(_0x231796,_0x267737),function(_0xea3fda){_0xea3fda['VoiceExtensionId']=_0x523ecd['id'];_0xea3fda[_0x4ff2('0x5f')]=_0x231796['id'];return _0xea3fda;});return db[_0x4ff2('0x4f')][_0x4ff2('0x60')](_0x27ca49,{'transaction':_0x135b3a})['then'](function(_0x52736b){if(!_0x52736b){return _0x39347b(_0x4ff2('0x61'));}else{return _0x3d7707(_0x52736b);}})[_0x4ff2('0x46')](function(_0x4da4e3){return _0x39347b(_0x4da4e3);});});;});};function addVoicePrefixExtensions(_0x2c14c3,_0x530f5a){var _0x3c0a11=[];var _0x598a29=formatPrefixName(_0x2c14c3[_0x4ff2('0x5d')]);_0x3c0a11[_0x4ff2('0x62')](new Extension(_0x598a29,0x2,_0x4ff2('0x63'),_0x4ff2('0x64')+_0x2c14c3[_0x4ff2('0x2b')]));if(_0x2c14c3['callerIdAll']){_0x3c0a11[_0x4ff2('0x62')](new Extension(_0x598a29,0x3,_0x4ff2('0x63'),'PREFIX-CALLERIDALL='+_0x2c14c3[_0x4ff2('0x65')]));}else{_0x3c0a11[_0x4ff2('0x62')](new Extension(_0x598a29,0x3,'NoOp',_0x4ff2('0x66')));}_0x3c0a11[_0x4ff2('0x62')](new Extension(_0x598a29,0x4,_0x4ff2('0x67'),_0x530f5a[_0x4ff2('0x56')]+','+'${EXTEN:'+(0x8+_0x2c14c3[_0x4ff2('0x2b')][_0x4ff2('0x36')])+'}'+','+0x1));return _0x3c0a11;}function formatPrefixName(_0xf3360e){var _0x43a8='_';for(var _0xfa0f97=0x0;_0xfa0f97<_0xf3360e[_0x4ff2('0x36')];_0xfa0f97++){if(_0xf3360e[_0x4ff2('0x68')](_0xfa0f97)=='-'){_0x43a8+=_0xf3360e[_0x4ff2('0x68')](_0xfa0f97);}else{_0x43a8+='['+_0xf3360e['charAt'](_0xfa0f97)+']';}}_0x43a8+='.';return _0x43a8;}exports[_0x4ff2('0x22')]=function(_0x82a694,_0xeadd04,_0x35d176){var _0x5a0541=_0x82a694[_0x4ff2('0x4e')];_0x5a0541['prefix']=_0x4ff2('0x69')+_0x5a0541[_0x4ff2('0x2b')]+'-';return db['sequelize'][_0x4ff2('0x4d')](function(_0x2caed7){return db['VoicePrefix'][_0x4ff2('0x22')](_0x5a0541,{'where':{'id':_0x5a0541['id']},'transaction':_0x2caed7})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x5a0541['id']},'transaction':_0x2caed7})[_0x4ff2('0x27')](function(){return db[_0x4ff2('0x4f')][_0x4ff2('0x49')]({'where':{'id':_0x5a0541[_0x4ff2('0x50')]},'raw':!![]})[_0x4ff2('0x27')](function(_0x385902){return createVoicePrefixExtensions(_0x5a0541,_0x385902,_0x2caed7);});});});})[_0x4ff2('0x27')](function(){return db['VoicePrefix'][_0x4ff2('0x6a')](_0x5a0541['id']);})[_0x4ff2('0x27')](respondWithResult(_0xeadd04,null))[_0x4ff2('0x46')](handleError(_0xeadd04,null));};exports[_0x4ff2('0x6b')]=function(_0x14751b,_0x2e53fb,_0xb679ee){return db[_0x4ff2('0x42')][_0x4ff2('0x49')]({'where':{'id':_0x14751b[_0x4ff2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e53fb,null))[_0x4ff2('0x27')](function(_0x34c5e8){if(_0x34c5e8){return _0x34c5e8[_0x4ff2('0x6b')](_0x14751b[_0x4ff2('0x4e')][_0x4ff2('0x6c')],_[_0x4ff2('0x6d')](_0x14751b[_0x4ff2('0x4e')],[_0x4ff2('0x6c'),'id'])||{})[_0x4ff2('0x6e')](function(_0x40ca01){for(var _0x3bc549=0x0;_0x3bc549<_0x14751b[_0x4ff2('0x4e')][_0x4ff2('0x6c')][_0x4ff2('0x36')];_0x3bc549+=0x1){socket[_0x4ff2('0x6f')](_0x4ff2('0x70'),{'UserId':_0x14751b['body']['ids'][_0x3bc549],'VoicePrefixId':_0x14751b[_0x4ff2('0x47')]['id']});}return _0x40ca01;});}})[_0x4ff2('0x27')](respondWithResult(_0x2e53fb,null))[_0x4ff2('0x46')](handleError(_0x2e53fb,null));};exports[_0x4ff2('0x71')]=function(_0x3c9ab7,_0x30674d,_0xf2d75a){return db[_0x4ff2('0x42')][_0x4ff2('0x49')]({'where':{'id':_0x3c9ab7[_0x4ff2('0x47')]['id']}})[_0x4ff2('0x27')](handleEntityNotFound(_0x30674d,null))['then'](function(_0x2e4f5b){if(_0x2e4f5b){return _0x2e4f5b[_0x4ff2('0x71')](_0x3c9ab7['query'][_0x4ff2('0x6c')])[_0x4ff2('0x27')](function(){if(_[_0x4ff2('0x72')](_0x3c9ab7[_0x4ff2('0x30')][_0x4ff2('0x6c')])){for(var _0x165e36=0x0;_0x165e36<_0x3c9ab7[_0x4ff2('0x30')][_0x4ff2('0x6c')]['length'];_0x165e36+=0x1){socket[_0x4ff2('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x3c9ab7[_0x4ff2('0x30')][_0x4ff2('0x6c')][_0x165e36]),'VoicePrefixId':Number(_0x3c9ab7[_0x4ff2('0x47')]['id'])});}}else{socket[_0x4ff2('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x3c9ab7[_0x4ff2('0x30')][_0x4ff2('0x6c')]),'VoicePrefixId':Number(_0x3c9ab7[_0x4ff2('0x47')]['id'])});}});}})[_0x4ff2('0x27')](respondWithStatusCode(_0x30674d,null))[_0x4ff2('0x46')](handleError(_0x30674d,null));};exports[_0x4ff2('0x73')]=function(_0x621a54,_0x5c760b,_0x353d41){var _0x535a08={};var _0x41d8a3={};var _0x58b772;var _0xc965a3;return db[_0x4ff2('0x42')][_0x4ff2('0x74')]({'where':{'id':_0x621a54[_0x4ff2('0x47')]['id']}})[_0x4ff2('0x27')](handleEntityNotFound(_0x5c760b,null))[_0x4ff2('0x27')](function(_0x16510f){if(_0x16510f){_0x58b772=_0x16510f;_0x41d8a3[_0x4ff2('0x2f')]=_['keys'](db[_0x4ff2('0x75')][_0x4ff2('0x2e')]);_0x41d8a3[_0x4ff2('0x30')]=_[_0x4ff2('0x31')](_0x621a54[_0x4ff2('0x30')]);_0x41d8a3['filters']=_['intersection'](_0x41d8a3[_0x4ff2('0x2f')],_0x41d8a3[_0x4ff2('0x30')]);_0x535a08[_0x4ff2('0x35')]=_[_0x4ff2('0x33')](_0x41d8a3[_0x4ff2('0x2f')],qs['fields'](_0x621a54['query'][_0x4ff2('0x34')]));_0x535a08[_0x4ff2('0x35')]=_0x535a08[_0x4ff2('0x35')][_0x4ff2('0x36')]?_0x535a08[_0x4ff2('0x35')]:_0x41d8a3[_0x4ff2('0x2f')];_0x535a08['order']=qs['sort'](_0x621a54['query']['sort']);_0x535a08['where']=qs['filters'](_['pick'](_0x621a54[_0x4ff2('0x30')],_0x41d8a3[_0x4ff2('0x32')]));if(_0x621a54[_0x4ff2('0x30')][_0x4ff2('0x3c')]){_0x535a08['where']=_[_0x4ff2('0x3e')](_0x535a08['where'],{'$or':_[_0x4ff2('0x2d')](_0x535a08['attributes'],function(_0x36c9ec){var _0x15463b={};_0x15463b[_0x36c9ec]={'$like':'%'+_0x621a54['query']['filter']+'%'};return _0x15463b;})});}_0x535a08=_['merge']({},_0x535a08,_0x621a54[_0x4ff2('0x41')]);return _0x58b772[_0x4ff2('0x73')](_0x535a08);}})[_0x4ff2('0x27')](function(_0x2a5bc2){if(_0x2a5bc2){_0xc965a3=_0x2a5bc2['length'];if(!_0x621a54[_0x4ff2('0x30')][_0x4ff2('0x37')](_0x4ff2('0x38'))){_0x535a08[_0x4ff2('0x1d')]=qs[_0x4ff2('0x1d')](_0x621a54[_0x4ff2('0x30')]['limit']);_0x535a08[_0x4ff2('0x1c')]=qs[_0x4ff2('0x1c')](_0x621a54['query'][_0x4ff2('0x1c')]);}return _0x58b772['getAgents'](_0x535a08);}})[_0x4ff2('0x27')](function(_0x193051){if(_0x193051){return _0x193051?{'count':_0xc965a3,'rows':_0x193051}:null;}})[_0x4ff2('0x27')](respondWithResult(_0x5c760b,null))[_0x4ff2('0x46')](handleError(_0x5c760b,null));};
\ No newline at end of file
+var _0x5f71=['fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','where','pick','filter','merge','map','options','includeAll','findAll','rows','show','rawAttributes','fields','include','find','catch','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','update','findById','addAgents','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','sort','hasOwnProperty','html-pdf','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','UserProfileResource','destroy','error','stack','name','send','VoicePrefix'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5f71,0xc9));var _0x15f7=function(_0xc1d509,_0x2529ec){_0xc1d509=_0xc1d509-0x0;var _0x2b3bcb=_0x5f71[_0xc1d509];return _0x2b3bcb;};'use strict';var pdf=require(_0x15f7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15f7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15f7('0x3'));var util=require(_0x15f7('0x4'));var path=require('path');var sox=require(_0x15f7('0x5'));var csv=require(_0x15f7('0x6'));var ejs=require(_0x15f7('0x7'));var fs=require('fs');var _=require(_0x15f7('0x8'));var squel=require(_0x15f7('0x9'));var crypto=require(_0x15f7('0xa'));var jsforce=require(_0x15f7('0xb'));var deskjs=require(_0x15f7('0xc'));var toCsv=require(_0x15f7('0x6'));var querystring=require(_0x15f7('0xd'));var Papa=require(_0x15f7('0xe'));var Redis=require(_0x15f7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x15f7('0x10'));var hardwareService=require(_0x15f7('0x11'));var logger=require('../../config/logger')(_0x15f7('0x12'));var utils=require(_0x15f7('0x13'));var config=require(_0x15f7('0x14'));var licenseUtil=require(_0x15f7('0x15'));var db=require(_0x15f7('0x16'))['db'];config[_0x15f7('0x17')]=_[_0x15f7('0x18')](config['redis'],{'host':_0x15f7('0x19'),'port':0x18eb});var socket=require(_0x15f7('0x1a'))(new Redis(config[_0x15f7('0x17')]));require('./voicePrefix.socket')[_0x15f7('0x1b')](socket);function respondWithStatusCode(_0x40dcb1,_0x52c1be){_0x52c1be=_0x52c1be||0xcc;return function(_0x24b6f5){if(_0x24b6f5){return _0x40dcb1[_0x15f7('0x1c')](_0x52c1be);}return _0x40dcb1[_0x15f7('0x1d')](_0x52c1be)[_0x15f7('0x1e')]();};}function respondWithResult(_0x345892,_0x2c0e67){_0x2c0e67=_0x2c0e67||0xc8;return function(_0x42928d){if(_0x42928d){return _0x345892['status'](_0x2c0e67)[_0x15f7('0x1f')](_0x42928d);}};}function respondWithFilteredResult(_0x385844,_0x4e61c9){return function(_0x2c78ca){if(_0x2c78ca){var _0x333ff8=_0x2c78ca[_0x15f7('0x20')],_0x2d4bc3=_0x4e61c9[_0x15f7('0x21')],_0x40b752=_0x4e61c9['offset']+_0x4e61c9[_0x15f7('0x22')],_0x26627b;if(_0x40b752>=_0x333ff8){_0x40b752=_0x333ff8;_0x26627b=0xc8;}else{_0x26627b=0xce;}_0x385844[_0x15f7('0x1d')](_0x26627b);return _0x385844[_0x15f7('0x23')](_0x15f7('0x24'),_0x2d4bc3+'-'+_0x40b752+'/'+_0x333ff8)[_0x15f7('0x1f')](_0x2c78ca);}return null;};}function patchUpdates(_0x28a8a6){return function(_0x3bf068){try{jsonpatch['apply'](_0x3bf068,_0x28a8a6,!![]);}catch(_0x4de467){return BPromise[_0x15f7('0x25')](_0x4de467);}return _0x3bf068[_0x15f7('0x26')]();};}function saveUpdates(_0x370652,_0x35de93){return function(_0x220d8e){if(_0x220d8e){return _0x220d8e['update'](_0x370652)[_0x15f7('0x27')](function(_0x4fe2ca){return _0x4fe2ca;});}return null;};}function removeEntity(_0x292958,_0xe6ec62){return function(_0x49fc13){if(_0x49fc13){return _0x49fc13['destroy']()[_0x15f7('0x27')](function(){var _0x5a1e21=_0x49fc13['get']({'plain':!![]});var _0x2928fa='VoicePrefixes';return db[_0x15f7('0x28')][_0x15f7('0x29')]({'where':{'type':_0x2928fa,'resourceId':_0x5a1e21['id']}})[_0x15f7('0x27')](function(){return _0x49fc13;});})[_0x15f7('0x27')](function(){_0x292958[_0x15f7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3adf28,_0x361d96){return function(_0x1b50ed){if(!_0x1b50ed){_0x3adf28['sendStatus'](0x194);}return _0x1b50ed;};}function handleError(_0x4dd3d6,_0x5962e6){_0x5962e6=_0x5962e6||0x1f4;return function(_0x508237){logger[_0x15f7('0x2a')](_0x508237[_0x15f7('0x2b')]);if(_0x508237[_0x15f7('0x2c')]){delete _0x508237[_0x15f7('0x2c')];}_0x4dd3d6[_0x15f7('0x1d')](_0x5962e6)[_0x15f7('0x2d')](_0x508237);};}exports['index']=function(_0x521934,_0x31bf43){var _0xd240bb={},_0x350f8a={},_0x4965ba={'count':0x0,'rows':[]};var _0x294ea7=_['map'](db[_0x15f7('0x2e')]['rawAttributes'],function(_0x31f44f){return{'name':_0x31f44f[_0x15f7('0x2f')],'type':_0x31f44f[_0x15f7('0x30')][_0x15f7('0x31')]};});_0x350f8a['model']=_['map'](_0x294ea7,_0x15f7('0x2c'));_0x350f8a[_0x15f7('0x32')]=_[_0x15f7('0x33')](_0x521934[_0x15f7('0x32')]);_0x350f8a[_0x15f7('0x34')]=_[_0x15f7('0x35')](_0x350f8a[_0x15f7('0x36')],_0x350f8a[_0x15f7('0x32')]);_0xd240bb[_0x15f7('0x37')]=_[_0x15f7('0x35')](_0x350f8a[_0x15f7('0x36')],qs['fields'](_0x521934[_0x15f7('0x32')]['fields']));_0xd240bb[_0x15f7('0x37')]=_0xd240bb[_0x15f7('0x37')][_0x15f7('0x38')]?_0xd240bb[_0x15f7('0x37')]:_0x350f8a[_0x15f7('0x36')];if(!_0x521934[_0x15f7('0x32')]['hasOwnProperty'](_0x15f7('0x39'))){_0xd240bb['limit']=qs[_0x15f7('0x22')](_0x521934[_0x15f7('0x32')][_0x15f7('0x22')]);_0xd240bb[_0x15f7('0x21')]=qs[_0x15f7('0x21')](_0x521934['query'][_0x15f7('0x21')]);}_0xd240bb['order']=qs['sort'](_0x521934[_0x15f7('0x32')]['sort']);_0xd240bb[_0x15f7('0x3a')]=qs[_0x15f7('0x34')](_[_0x15f7('0x3b')](_0x521934[_0x15f7('0x32')],_0x350f8a[_0x15f7('0x34')]),_0x294ea7);if(_0x521934[_0x15f7('0x32')][_0x15f7('0x3c')]){_0xd240bb['where']=_[_0x15f7('0x3d')](_0xd240bb['where'],{'$or':_[_0x15f7('0x3e')](_0x294ea7,function(_0x4d409f){if(_0x4d409f['type']!=='VIRTUAL'){var _0x2054cf={};_0x2054cf[_0x4d409f[_0x15f7('0x2c')]]={'$like':'%'+_0x521934[_0x15f7('0x32')][_0x15f7('0x3c')]+'%'};return _0x2054cf;}})});}_0xd240bb=_[_0x15f7('0x3d')]({},_0xd240bb,_0x521934[_0x15f7('0x3f')]);var _0x180345={'where':_0xd240bb[_0x15f7('0x3a')]};return db[_0x15f7('0x2e')][_0x15f7('0x20')](_0x180345)[_0x15f7('0x27')](function(_0x2fc31e){_0x4965ba['count']=_0x2fc31e;if(_0x521934[_0x15f7('0x32')][_0x15f7('0x40')]){_0xd240bb['include']=[{'all':!![]}];}return db[_0x15f7('0x2e')][_0x15f7('0x41')](_0xd240bb);})['then'](function(_0x225dcb){_0x4965ba[_0x15f7('0x42')]=_0x225dcb;return _0x4965ba;})[_0x15f7('0x27')](respondWithFilteredResult(_0x31bf43,_0xd240bb))['catch'](handleError(_0x31bf43,null));};exports[_0x15f7('0x43')]=function(_0x3a49e3,_0x2d4fdc){var _0x565e54={'raw':![],'where':{'id':_0x3a49e3['params']['id']}},_0xc31ca7={};_0xc31ca7[_0x15f7('0x36')]=_[_0x15f7('0x33')](db[_0x15f7('0x2e')][_0x15f7('0x44')]);_0xc31ca7[_0x15f7('0x32')]=_[_0x15f7('0x33')](_0x3a49e3[_0x15f7('0x32')]);_0xc31ca7[_0x15f7('0x34')]=_[_0x15f7('0x35')](_0xc31ca7[_0x15f7('0x36')],_0xc31ca7[_0x15f7('0x32')]);_0x565e54[_0x15f7('0x37')]=_['intersection'](_0xc31ca7[_0x15f7('0x36')],qs['fields'](_0x3a49e3[_0x15f7('0x32')][_0x15f7('0x45')]));_0x565e54['attributes']=_0x565e54['attributes'][_0x15f7('0x38')]?_0x565e54[_0x15f7('0x37')]:_0xc31ca7[_0x15f7('0x36')];if(_0x3a49e3['query'][_0x15f7('0x40')]){_0x565e54[_0x15f7('0x46')]=[{'all':!![]}];}_0x565e54=_[_0x15f7('0x3d')]({},_0x565e54,_0x3a49e3[_0x15f7('0x3f')]);return db[_0x15f7('0x2e')][_0x15f7('0x47')](_0x565e54)['then'](handleEntityNotFound(_0x2d4fdc,null))['then'](respondWithResult(_0x2d4fdc,null))[_0x15f7('0x48')](handleError(_0x2d4fdc,null));};exports['destroy']=function(_0x31717c,_0x3f26fc){return db['VoicePrefix'][_0x15f7('0x47')]({'where':{'id':_0x31717c[_0x15f7('0x49')]['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x3f26fc,null))[_0x15f7('0x27')](removeEntity(_0x3f26fc,null))[_0x15f7('0x48')](handleError(_0x3f26fc,null));};exports[_0x15f7('0x4a')]=function(_0x703ec3,_0x50e427){return db[_0x15f7('0x2e')][_0x15f7('0x4a')]()[_0x15f7('0x27')](respondWithResult(_0x50e427,null))[_0x15f7('0x48')](handleError(_0x50e427,null));};exports[_0x15f7('0x4b')]=function(_0x129806,_0x27e5a8){var _0x587f7f;return db[_0x15f7('0x4c')][_0x15f7('0x4d')](function(_0x486994){return db[_0x15f7('0x2e')][_0x15f7('0x4b')](_0x129806[_0x15f7('0x4e')],{'transaction':_0x486994})['then'](function(_0x46b89c){_0x587f7f=_0x46b89c['get']({'plain':!![]});return db[_0x15f7('0x4f')][_0x15f7('0x47')]({'where':{'id':_0x587f7f[_0x15f7('0x50')]},'raw':!![]})['then'](function(_0x45468f){return createVoicePrefixExtensions(_0x587f7f,_0x45468f,_0x486994);});});})[_0x15f7('0x27')](function(){var _0x35ad5c=_0x129806['user'][_0x15f7('0x51')]({'plain':!![]});if(!_0x35ad5c)throw new Error(_0x15f7('0x52'));if(_0x35ad5c[_0x15f7('0x53')]===_0x15f7('0x54')){var _0xc6d585=_0x587f7f;return db['UserProfileSection'][_0x15f7('0x47')]({'where':{'name':_0x15f7('0x55'),'userProfileId':_0x35ad5c['userProfileId']},'raw':!![]})['then'](function(_0x5a4ead){if(_0x5a4ead&&_0x5a4ead[_0x15f7('0x56')]===0x0){return db[_0x15f7('0x28')][_0x15f7('0x4b')]({'name':_0xc6d585['name'],'resourceId':_0xc6d585['id'],'type':_0x5a4ead[_0x15f7('0x2c')],'sectionId':_0x5a4ead['id']},{})[_0x15f7('0x27')](function(){return _0x587f7f;});}else{return _0x587f7f;}})['catch'](function(_0x15ce9e){logger[_0x15f7('0x2a')](_0x15f7('0x57'),_0x15ce9e);throw _0x15ce9e;});}return _0x587f7f;})[_0x15f7('0x27')](respondWithResult(_0x27e5a8,null))['catch'](handleError(_0x27e5a8,null));};function Extension(_0x30f6a0,_0x363f8c,_0x3fc6d8,_0x46e9de){this['context']=_0x15f7('0x58');this[_0x15f7('0x59')]=_0x30f6a0;this[_0x15f7('0x5a')]=_0x3fc6d8;this[_0x15f7('0x30')]='system';this['description']=_0x15f7('0x5b');this[_0x15f7('0x5c')]=_0x363f8c;this[_0x15f7('0x5d')]=_0x46e9de;}function createVoicePrefixExtensions(_0x4d4b11,_0x4c85ae,_0x184030){return new BPromise(function(_0x31208b,_0x9cedc1){var _0x952456=new Extension(formatPrefixName(_0x4d4b11[_0x15f7('0x5e')]),0x1,_0x15f7('0x5f'),_0x15f7('0x60'));_0x952456[_0x15f7('0x61')]=_0x4d4b11['id'];return db[_0x15f7('0x4f')]['create'](_0x952456,{'transaction':_0x184030})['then'](function(_0x54199c){var _0x1d7f80=_0x54199c[_0x15f7('0x51')]({'plain':!![]});var _0x33e73b=_[_0x15f7('0x3e')](addVoicePrefixExtensions(_0x4d4b11,_0x4c85ae),function(_0x3c8616){_0x3c8616['VoiceExtensionId']=_0x1d7f80['id'];_0x3c8616[_0x15f7('0x61')]=_0x4d4b11['id'];return _0x3c8616;});return db[_0x15f7('0x4f')][_0x15f7('0x62')](_0x33e73b,{'transaction':_0x184030})[_0x15f7('0x27')](function(_0x43445b){if(!_0x43445b){return _0x9cedc1(_0x15f7('0x63'));}else{return _0x31208b(_0x43445b);}})[_0x15f7('0x48')](function(_0x49ce52){return _0x9cedc1(_0x49ce52);});});;});};function addVoicePrefixExtensions(_0x405103,_0x5f5764){var _0x42d1c9=[];var _0x18e25e=formatPrefixName(_0x405103[_0x15f7('0x5e')]);_0x42d1c9[_0x15f7('0x64')](new Extension(_0x18e25e,0x2,_0x15f7('0x65'),_0x15f7('0x66')+_0x405103[_0x15f7('0x2c')]));if(_0x405103[_0x15f7('0x67')]){_0x42d1c9['push'](new Extension(_0x18e25e,0x3,_0x15f7('0x65'),_0x15f7('0x68')+_0x405103['callerIdAll']));}else{_0x42d1c9[_0x15f7('0x64')](new Extension(_0x18e25e,0x3,'NoOp',_0x15f7('0x69')));}_0x42d1c9[_0x15f7('0x64')](new Extension(_0x18e25e,0x4,_0x15f7('0x6a'),_0x5f5764[_0x15f7('0x6b')]+','+'${EXTEN:'+(0x8+_0x405103['name']['length'])+'}'+','+0x1));return _0x42d1c9;}function formatPrefixName(_0x21e727){var _0x343b44='_';for(var _0x249087=0x0;_0x249087<_0x21e727[_0x15f7('0x38')];_0x249087++){if(_0x21e727[_0x15f7('0x6c')](_0x249087)=='-'){_0x343b44+=_0x21e727[_0x15f7('0x6c')](_0x249087);}else{_0x343b44+='['+_0x21e727['charAt'](_0x249087)+']';}}_0x343b44+='.';return _0x343b44;}exports['update']=function(_0x525bbe,_0x1ee691,_0x3504dd){var _0x518c0a=_0x525bbe[_0x15f7('0x4e')];_0x518c0a[_0x15f7('0x5e')]=_0x15f7('0x6d')+_0x518c0a[_0x15f7('0x2c')]+'-';return db[_0x15f7('0x4c')][_0x15f7('0x4d')](function(_0x580579){return db[_0x15f7('0x2e')][_0x15f7('0x6e')](_0x518c0a,{'where':{'id':_0x518c0a['id']},'transaction':_0x580579})['then'](function(){return db[_0x15f7('0x4f')][_0x15f7('0x29')]({'where':{'VoicePrefixId':_0x518c0a['id']},'transaction':_0x580579})[_0x15f7('0x27')](function(){return db[_0x15f7('0x4f')]['find']({'where':{'id':_0x518c0a[_0x15f7('0x50')]},'raw':!![]})[_0x15f7('0x27')](function(_0x29d280){return createVoicePrefixExtensions(_0x518c0a,_0x29d280,_0x580579);});});});})[_0x15f7('0x27')](function(){return db['VoicePrefix'][_0x15f7('0x6f')](_0x518c0a['id']);})[_0x15f7('0x27')](respondWithResult(_0x1ee691,null))[_0x15f7('0x48')](handleError(_0x1ee691,null));};exports[_0x15f7('0x70')]=function(_0x1e7fc7,_0x447b8d,_0x4133a5){return db['VoicePrefix'][_0x15f7('0x47')]({'where':{'id':_0x1e7fc7[_0x15f7('0x49')]['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x447b8d,null))['then'](function(_0x3895d8){if(_0x3895d8){return _0x3895d8['addAgents'](_0x1e7fc7['body'][_0x15f7('0x71')],_[_0x15f7('0x72')](_0x1e7fc7['body'],['ids','id'])||{})['spread'](function(_0x24204b){for(var _0x36d3af=0x0;_0x36d3af<_0x1e7fc7[_0x15f7('0x4e')][_0x15f7('0x71')][_0x15f7('0x38')];_0x36d3af+=0x1){socket['emit'](_0x15f7('0x73'),{'UserId':_0x1e7fc7['body'][_0x15f7('0x71')][_0x36d3af],'VoicePrefixId':_0x1e7fc7[_0x15f7('0x49')]['id']});}return _0x24204b;});}})['then'](respondWithResult(_0x447b8d,null))[_0x15f7('0x48')](handleError(_0x447b8d,null));};exports[_0x15f7('0x74')]=function(_0x8c0a2a,_0x59d10f,_0x126cba){return db[_0x15f7('0x2e')]['find']({'where':{'id':_0x8c0a2a['params']['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x59d10f,null))['then'](function(_0x7716dd){if(_0x7716dd){return _0x7716dd[_0x15f7('0x74')](_0x8c0a2a[_0x15f7('0x32')][_0x15f7('0x71')])[_0x15f7('0x27')](function(){if(_[_0x15f7('0x75')](_0x8c0a2a[_0x15f7('0x32')][_0x15f7('0x71')])){for(var _0x3d064f=0x0;_0x3d064f<_0x8c0a2a[_0x15f7('0x32')][_0x15f7('0x71')][_0x15f7('0x38')];_0x3d064f+=0x1){socket[_0x15f7('0x76')](_0x15f7('0x77'),{'UserId':Number(_0x8c0a2a[_0x15f7('0x32')][_0x15f7('0x71')][_0x3d064f]),'VoicePrefixId':Number(_0x8c0a2a[_0x15f7('0x49')]['id'])});}}else{socket[_0x15f7('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x8c0a2a[_0x15f7('0x32')]['ids']),'VoicePrefixId':Number(_0x8c0a2a['params']['id'])});}});}})[_0x15f7('0x27')](respondWithStatusCode(_0x59d10f,null))['catch'](handleError(_0x59d10f,null));};exports[_0x15f7('0x78')]=function(_0x5476f2,_0x3027ad,_0x8a4ee9){var _0x4225c0={};var _0x343f50={};var _0x547b77;var _0x184af9;return db[_0x15f7('0x2e')][_0x15f7('0x79')]({'where':{'id':_0x5476f2[_0x15f7('0x49')]['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x3027ad,null))[_0x15f7('0x27')](function(_0x200924){if(_0x200924){_0x547b77=_0x200924;_0x343f50[_0x15f7('0x36')]=_[_0x15f7('0x33')](db['User'][_0x15f7('0x44')]);_0x343f50['query']=_[_0x15f7('0x33')](_0x5476f2['query']);_0x343f50[_0x15f7('0x34')]=_['intersection'](_0x343f50[_0x15f7('0x36')],_0x343f50[_0x15f7('0x32')]);_0x4225c0[_0x15f7('0x37')]=_['intersection'](_0x343f50['model'],qs[_0x15f7('0x45')](_0x5476f2[_0x15f7('0x32')][_0x15f7('0x45')]));_0x4225c0[_0x15f7('0x37')]=_0x4225c0[_0x15f7('0x37')][_0x15f7('0x38')]?_0x4225c0[_0x15f7('0x37')]:_0x343f50['model'];_0x4225c0['order']=qs[_0x15f7('0x7a')](_0x5476f2[_0x15f7('0x32')][_0x15f7('0x7a')]);_0x4225c0[_0x15f7('0x3a')]=qs[_0x15f7('0x34')](_[_0x15f7('0x3b')](_0x5476f2[_0x15f7('0x32')],_0x343f50['filters']));if(_0x5476f2[_0x15f7('0x32')][_0x15f7('0x3c')]){_0x4225c0['where']=_['merge'](_0x4225c0['where'],{'$or':_[_0x15f7('0x3e')](_0x4225c0[_0x15f7('0x37')],function(_0x3d770e){var _0x22923b={};_0x22923b[_0x3d770e]={'$like':'%'+_0x5476f2[_0x15f7('0x32')][_0x15f7('0x3c')]+'%'};return _0x22923b;})});}_0x4225c0=_[_0x15f7('0x3d')]({},_0x4225c0,_0x5476f2[_0x15f7('0x3f')]);return _0x547b77[_0x15f7('0x78')](_0x4225c0);}})[_0x15f7('0x27')](function(_0x1c53d7){if(_0x1c53d7){_0x184af9=_0x1c53d7['length'];if(!_0x5476f2[_0x15f7('0x32')][_0x15f7('0x7b')](_0x15f7('0x39'))){_0x4225c0['limit']=qs['limit'](_0x5476f2[_0x15f7('0x32')][_0x15f7('0x22')]);_0x4225c0[_0x15f7('0x21')]=qs[_0x15f7('0x21')](_0x5476f2[_0x15f7('0x32')][_0x15f7('0x21')]);}return _0x547b77[_0x15f7('0x78')](_0x4225c0);}})['then'](function(_0x20856a){if(_0x20856a){return _0x20856a?{'count':_0x184af9,'rows':_0x20856a}:null;}})['then'](respondWithResult(_0x3027ad,null))['catch'](handleError(_0x3027ad,null));};
\ No newline at end of file