Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index aee1bac..b8252c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bfc=['getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','send','index','ZendeskConfiguration','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','create','body','catch','find','destroy'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x3bfc,0x10f));var _0xc3bf=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x3bfc[_0x469fc4];return _0x11f6d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3bf('0x0'));var zipdir=require(_0xc3bf('0x1'));var jsonpatch=require(_0xc3bf('0x2'));var rp=require(_0xc3bf('0x3'));var moment=require('moment');var BPromise=require(_0xc3bf('0x4'));var Mustache=require(_0xc3bf('0x5'));var util=require(_0xc3bf('0x6'));var path=require(_0xc3bf('0x7'));var sox=require(_0xc3bf('0x8'));var csv=require('to-csv');var ejs=require(_0xc3bf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3bf('0xa'));var squel=require(_0xc3bf('0xb'));var crypto=require('crypto');var jsforce=require(_0xc3bf('0xc'));var deskjs=require(_0xc3bf('0xd'));var toCsv=require(_0xc3bf('0xe'));var querystring=require(_0xc3bf('0xf'));var Papa=require(_0xc3bf('0x10'));var Redis=require(_0xc3bf('0x11'));var authService=require(_0xc3bf('0x12'));var qs=require(_0xc3bf('0x13'));var as=require(_0xc3bf('0x14'));var hardwareService=require(_0xc3bf('0x15'));var logger=require(_0xc3bf('0x16'))(_0xc3bf('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc3bf('0x18'));var db=require(_0xc3bf('0x19'))['db'];function respondWithStatusCode(_0x315c13,_0x1d26a8){_0x1d26a8=_0x1d26a8||0xcc;return function(_0x1be25f){if(_0x1be25f){return _0x315c13[_0xc3bf('0x1a')](_0x1d26a8);}return _0x315c13[_0xc3bf('0x1b')](_0x1d26a8)[_0xc3bf('0x1c')]();};}function respondWithResult(_0x2b6b63,_0x49ef02){_0x49ef02=_0x49ef02||0xc8;return function(_0x41057e){if(_0x41057e){return _0x2b6b63[_0xc3bf('0x1b')](_0x49ef02)[_0xc3bf('0x1d')](_0x41057e);}};}function respondWithFilteredResult(_0x378ab2,_0x3f19a8){return function(_0xbf86f7){if(_0xbf86f7){var _0x308fa2=typeof _0x3f19a8[_0xc3bf('0x1e')]===_0xc3bf('0x1f')&&typeof _0x3f19a8[_0xc3bf('0x20')]===_0xc3bf('0x1f');var _0x311e60=_0xbf86f7[_0xc3bf('0x21')];var _0xef1bcc=_0x308fa2?0x0:_0x3f19a8[_0xc3bf('0x1e')];var _0x88b586=_0x308fa2?_0xbf86f7[_0xc3bf('0x21')]:_0x3f19a8[_0xc3bf('0x1e')]+_0x3f19a8[_0xc3bf('0x20')];var _0x465cd9;if(_0x88b586>=_0x311e60){_0x88b586=_0x311e60;_0x465cd9=0xc8;}else{_0x465cd9=0xce;}_0x378ab2['status'](_0x465cd9);return _0x378ab2[_0xc3bf('0x22')](_0xc3bf('0x23'),_0xef1bcc+'-'+_0x88b586+'/'+_0x311e60)[_0xc3bf('0x1d')](_0xbf86f7);}return null;};}function patchUpdates(_0x3c0545){return function(_0x454f62){try{jsonpatch[_0xc3bf('0x24')](_0x454f62,_0x3c0545,!![]);}catch(_0x241eb3){return BPromise[_0xc3bf('0x25')](_0x241eb3);}return _0x454f62[_0xc3bf('0x26')]();};}function saveUpdates(_0x461c64,_0x277825){return function(_0xe7c1df){if(_0xe7c1df){return _0xe7c1df['update'](_0x461c64)[_0xc3bf('0x27')](function(_0x38aed7){return _0x38aed7;});}return null;};}function removeEntity(_0x1554c3,_0x32dd60){return function(_0xe9c45e){if(_0xe9c45e){return _0xe9c45e['destroy']()[_0xc3bf('0x27')](function(){_0x1554c3[_0xc3bf('0x1b')](0xcc)[_0xc3bf('0x1c')]();});}};}function handleEntityNotFound(_0x1b98eb,_0x22ab44){return function(_0x28bfbe){if(!_0x28bfbe){_0x1b98eb[_0xc3bf('0x1a')](0x194);}return _0x28bfbe;};}function handleError(_0x197adc,_0x623fe8){_0x623fe8=_0x623fe8||0x1f4;return function(_0x414369){logger['error'](_0x414369[_0xc3bf('0x28')]);if(_0x414369['name']){delete _0x414369['name'];}_0x197adc[_0xc3bf('0x1b')](_0x623fe8)[_0xc3bf('0x29')](_0x414369);};}exports[_0xc3bf('0x2a')]=function(_0x255bfa,_0x49d42e){var _0x9368ea={},_0x2a16f4={},_0x56c099={'count':0x0,'rows':[]};var _0x3b6db2=_['map'](db[_0xc3bf('0x2b')]['rawAttributes'],function(_0x56ed2e){return{'name':_0x56ed2e[_0xc3bf('0x2c')],'type':_0x56ed2e['type'][_0xc3bf('0x2d')]};});_0x2a16f4[_0xc3bf('0x2e')]=_[_0xc3bf('0x2f')](_0x3b6db2,_0xc3bf('0x30'));_0x2a16f4[_0xc3bf('0x31')]=_[_0xc3bf('0x32')](_0x255bfa[_0xc3bf('0x31')]);_0x2a16f4[_0xc3bf('0x33')]=_[_0xc3bf('0x34')](_0x2a16f4['model'],_0x2a16f4[_0xc3bf('0x31')]);_0x9368ea[_0xc3bf('0x35')]=_[_0xc3bf('0x34')](_0x2a16f4[_0xc3bf('0x2e')],qs[_0xc3bf('0x36')](_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x36')]));_0x9368ea[_0xc3bf('0x35')]=_0x9368ea['attributes'][_0xc3bf('0x37')]?_0x9368ea[_0xc3bf('0x35')]:_0x2a16f4['model'];if(!_0x255bfa[_0xc3bf('0x31')]['hasOwnProperty'](_0xc3bf('0x38'))){_0x9368ea[_0xc3bf('0x20')]=qs[_0xc3bf('0x20')](_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x20')]);_0x9368ea[_0xc3bf('0x1e')]=qs[_0xc3bf('0x1e')](_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x1e')]);}_0x9368ea[_0xc3bf('0x39')]=qs[_0xc3bf('0x3a')](_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x3a')]);_0x9368ea[_0xc3bf('0x3b')]=qs[_0xc3bf('0x33')](_[_0xc3bf('0x3c')](_0x255bfa[_0xc3bf('0x31')],_0x2a16f4[_0xc3bf('0x33')]),_0x3b6db2);if(_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x3d')]){_0x9368ea[_0xc3bf('0x3b')]=_[_0xc3bf('0x3e')](_0x9368ea[_0xc3bf('0x3b')],{'$or':_[_0xc3bf('0x2f')](_0x3b6db2,function(_0x4b51d4){if(_0x4b51d4[_0xc3bf('0x3f')]!==_0xc3bf('0x40')){var _0xcb92f0={};_0xcb92f0[_0x4b51d4[_0xc3bf('0x30')]]={'$like':'%'+_0x255bfa[_0xc3bf('0x31')][_0xc3bf('0x3d')]+'%'};return _0xcb92f0;}})});}_0x9368ea=_[_0xc3bf('0x3e')]({},_0x9368ea,_0x255bfa[_0xc3bf('0x41')]);var _0x561eb9={'where':_0x9368ea[_0xc3bf('0x3b')]};return db[_0xc3bf('0x2b')][_0xc3bf('0x21')](_0x561eb9)[_0xc3bf('0x27')](function(_0x5c57f7){_0x56c099[_0xc3bf('0x21')]=_0x5c57f7;if(_0x255bfa['query'][_0xc3bf('0x42')]){_0x9368ea['include']=[{'all':!![]}];}return db[_0xc3bf('0x2b')][_0xc3bf('0x43')](_0x9368ea);})[_0xc3bf('0x27')](function(_0x4ad1ef){_0x56c099[_0xc3bf('0x44')]=_0x4ad1ef;return _0x56c099;})['then'](respondWithFilteredResult(_0x49d42e,_0x9368ea))['catch'](handleError(_0x49d42e,null));};exports['show']=function(_0x27be83,_0x2432f6){var _0xeda5b7={'raw':![],'where':{'id':_0x27be83[_0xc3bf('0x45')]['id']}},_0x2d196d={};_0x2d196d[_0xc3bf('0x2e')]=_[_0xc3bf('0x32')](db[_0xc3bf('0x2b')][_0xc3bf('0x46')]);_0x2d196d['query']=_[_0xc3bf('0x32')](_0x27be83['query']);_0x2d196d[_0xc3bf('0x33')]=_[_0xc3bf('0x34')](_0x2d196d[_0xc3bf('0x2e')],_0x2d196d['query']);_0xeda5b7[_0xc3bf('0x35')]=_[_0xc3bf('0x34')](_0x2d196d[_0xc3bf('0x2e')],qs[_0xc3bf('0x36')](_0x27be83[_0xc3bf('0x31')]['fields']));_0xeda5b7[_0xc3bf('0x35')]=_0xeda5b7['attributes'][_0xc3bf('0x37')]?_0xeda5b7[_0xc3bf('0x35')]:_0x2d196d[_0xc3bf('0x2e')];if(_0x27be83[_0xc3bf('0x31')][_0xc3bf('0x42')]){_0xeda5b7[_0xc3bf('0x47')]=[{'all':!![]}];}_0xeda5b7=_['merge']({},_0xeda5b7,_0x27be83[_0xc3bf('0x41')]);return db['ZendeskConfiguration']['find'](_0xeda5b7)['then'](handleEntityNotFound(_0x2432f6,null))[_0xc3bf('0x27')](respondWithResult(_0x2432f6,null))['catch'](handleError(_0x2432f6,null));};exports[_0xc3bf('0x48')]=function(_0x2969c8,_0x3c8139){return db[_0xc3bf('0x2b')][_0xc3bf('0x48')](_0x2969c8[_0xc3bf('0x49')],{})[_0xc3bf('0x27')](respondWithResult(_0x3c8139,0xc9))[_0xc3bf('0x4a')](handleError(_0x3c8139,null));};exports['update']=function(_0x5e407f,_0x5440ba){if(_0x5e407f[_0xc3bf('0x49')]['id']){delete _0x5e407f[_0xc3bf('0x49')]['id'];}return db[_0xc3bf('0x2b')][_0xc3bf('0x4b')]({'where':{'id':_0x5e407f[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x5440ba,null))[_0xc3bf('0x27')](saveUpdates(_0x5e407f[_0xc3bf('0x49')],null))[_0xc3bf('0x27')](respondWithResult(_0x5440ba,null))[_0xc3bf('0x4a')](handleError(_0x5440ba,null));};exports[_0xc3bf('0x4c')]=function(_0x352b59,_0x11f89b){return db[_0xc3bf('0x2b')]['find']({'where':{'id':_0x352b59['params']['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x11f89b,null))['then'](removeEntity(_0x11f89b,null))['catch'](handleError(_0x11f89b,null));};exports[_0xc3bf('0x4d')]=function(_0x2fb254,_0x7f97f3,_0x1f905f){var _0x3690fd={};var _0x531253={};var _0x5725cc;var _0x24dba9;return db[_0xc3bf('0x2b')][_0xc3bf('0x4e')]({'where':{'id':_0x2fb254[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x7f97f3,null))[_0xc3bf('0x27')](function(_0x3782c8){if(_0x3782c8){_0x5725cc=_0x3782c8;_0x531253[_0xc3bf('0x2e')]=_[_0xc3bf('0x32')](db[_0xc3bf('0x4f')][_0xc3bf('0x46')]);_0x531253['query']=_['keys'](_0x2fb254[_0xc3bf('0x31')]);_0x531253[_0xc3bf('0x33')]=_[_0xc3bf('0x34')](_0x531253[_0xc3bf('0x2e')],_0x531253[_0xc3bf('0x31')]);_0x3690fd[_0xc3bf('0x35')]=_[_0xc3bf('0x34')](_0x531253[_0xc3bf('0x2e')],qs['fields'](_0x2fb254[_0xc3bf('0x31')]['fields']));_0x3690fd[_0xc3bf('0x35')]=_0x3690fd['attributes'][_0xc3bf('0x37')]?_0x3690fd['attributes']:_0x531253[_0xc3bf('0x2e')];_0x3690fd[_0xc3bf('0x39')]=qs['sort'](_0x2fb254[_0xc3bf('0x31')]['sort']);_0x3690fd[_0xc3bf('0x3b')]=qs['filters'](_[_0xc3bf('0x3c')](_0x2fb254['query'],_0x531253[_0xc3bf('0x33')]));if(_0x2fb254[_0xc3bf('0x31')]['filter']){_0x3690fd['where']=_[_0xc3bf('0x3e')](_0x3690fd[_0xc3bf('0x3b')],{'$or':_[_0xc3bf('0x2f')](_0x3690fd[_0xc3bf('0x35')],function(_0x3c2b25){var _0x37ea23={};_0x37ea23[_0x3c2b25]={'$like':'%'+_0x2fb254[_0xc3bf('0x31')][_0xc3bf('0x3d')]+'%'};return _0x37ea23;})});}_0x3690fd=_['merge']({},_0x3690fd,_0x2fb254[_0xc3bf('0x41')]);return _0x5725cc[_0xc3bf('0x4d')](_0x3690fd);}})[_0xc3bf('0x27')](function(_0x1fbad8){if(_0x1fbad8){_0x24dba9=_0x1fbad8[_0xc3bf('0x37')];if(!_0x2fb254['query'][_0xc3bf('0x50')]('nolimit')){_0x3690fd[_0xc3bf('0x20')]=qs[_0xc3bf('0x20')](_0x2fb254[_0xc3bf('0x31')][_0xc3bf('0x20')]);_0x3690fd['offset']=qs[_0xc3bf('0x1e')](_0x2fb254['query'][_0xc3bf('0x1e')]);}return _0x5725cc[_0xc3bf('0x4d')](_0x3690fd);}})['then'](function(_0xa25833){if(_0xa25833){return _0xa25833?{'count':_0x24dba9,'rows':_0xa25833}:null;}})['then'](respondWithResult(_0x7f97f3,null))['catch'](handleError(_0x7f97f3,null));};exports['getSubjects']=function(_0xae513d,_0x6f6c14,_0xe67c4c){var _0x1cf514={};var _0x1b1af={};var _0x207788;var _0x6546ca;return db[_0xc3bf('0x2b')][_0xc3bf('0x4e')]({'where':{'id':_0xae513d[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x6f6c14,null))['then'](function(_0x45de9c){if(_0x45de9c){_0x207788=_0x45de9c;_0x1b1af['model']=_[_0xc3bf('0x32')](db[_0xc3bf('0x4f')][_0xc3bf('0x46')]);_0x1b1af[_0xc3bf('0x31')]=_[_0xc3bf('0x32')](_0xae513d[_0xc3bf('0x31')]);_0x1b1af[_0xc3bf('0x33')]=_['intersection'](_0x1b1af[_0xc3bf('0x2e')],_0x1b1af['query']);_0x1cf514[_0xc3bf('0x35')]=_[_0xc3bf('0x34')](_0x1b1af['model'],qs['fields'](_0xae513d[_0xc3bf('0x31')][_0xc3bf('0x36')]));_0x1cf514['attributes']=_0x1cf514[_0xc3bf('0x35')][_0xc3bf('0x37')]?_0x1cf514['attributes']:_0x1b1af['model'];_0x1cf514[_0xc3bf('0x39')]=qs[_0xc3bf('0x3a')](_0xae513d[_0xc3bf('0x31')][_0xc3bf('0x3a')]);_0x1cf514['where']=qs[_0xc3bf('0x33')](_['pick'](_0xae513d['query'],_0x1b1af[_0xc3bf('0x33')]));if(_0xae513d[_0xc3bf('0x31')][_0xc3bf('0x3d')]){_0x1cf514[_0xc3bf('0x3b')]=_[_0xc3bf('0x3e')](_0x1cf514['where'],{'$or':_[_0xc3bf('0x2f')](_0x1cf514[_0xc3bf('0x35')],function(_0x34058e){var _0x38ef0b={};_0x38ef0b[_0x34058e]={'$like':'%'+_0xae513d['query'][_0xc3bf('0x3d')]+'%'};return _0x38ef0b;})});}_0x1cf514=_[_0xc3bf('0x3e')]({},_0x1cf514,_0xae513d[_0xc3bf('0x41')]);return _0x207788[_0xc3bf('0x51')](_0x1cf514);}})[_0xc3bf('0x27')](function(_0x41abb3){if(_0x41abb3){_0x6546ca=_0x41abb3[_0xc3bf('0x37')];if(!_0xae513d[_0xc3bf('0x31')][_0xc3bf('0x50')]('nolimit')){_0x1cf514[_0xc3bf('0x20')]=qs['limit'](_0xae513d[_0xc3bf('0x31')]['limit']);_0x1cf514[_0xc3bf('0x1e')]=qs[_0xc3bf('0x1e')](_0xae513d[_0xc3bf('0x31')][_0xc3bf('0x1e')]);}return _0x207788['getSubjects'](_0x1cf514);}})[_0xc3bf('0x27')](function(_0x3c9615){if(_0x3c9615){return _0x3c9615?{'count':_0x6546ca,'rows':_0x3c9615}:null;}})[_0xc3bf('0x27')](respondWithResult(_0x6f6c14,null))[_0xc3bf('0x4a')](handleError(_0x6f6c14,null));};exports['getDescriptions']=function(_0x585e60,_0x49d763,_0x4cfaa5){var _0x4d2b4a={};var _0x37638b={};var _0x18b331;var _0x529ec9;return db[_0xc3bf('0x2b')]['findOne']({'where':{'id':_0x585e60[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x49d763,null))[_0xc3bf('0x27')](function(_0x15353c){if(_0x15353c){_0x18b331=_0x15353c;_0x37638b[_0xc3bf('0x2e')]=_['keys'](db[_0xc3bf('0x4f')][_0xc3bf('0x46')]);_0x37638b[_0xc3bf('0x31')]=_[_0xc3bf('0x32')](_0x585e60[_0xc3bf('0x31')]);_0x37638b[_0xc3bf('0x33')]=_[_0xc3bf('0x34')](_0x37638b[_0xc3bf('0x2e')],_0x37638b[_0xc3bf('0x31')]);_0x4d2b4a[_0xc3bf('0x35')]=_['intersection'](_0x37638b[_0xc3bf('0x2e')],qs[_0xc3bf('0x36')](_0x585e60[_0xc3bf('0x31')]['fields']));_0x4d2b4a[_0xc3bf('0x35')]=_0x4d2b4a['attributes'][_0xc3bf('0x37')]?_0x4d2b4a['attributes']:_0x37638b[_0xc3bf('0x2e')];_0x4d2b4a[_0xc3bf('0x39')]=qs['sort'](_0x585e60[_0xc3bf('0x31')][_0xc3bf('0x3a')]);_0x4d2b4a[_0xc3bf('0x3b')]=qs[_0xc3bf('0x33')](_[_0xc3bf('0x3c')](_0x585e60[_0xc3bf('0x31')],_0x37638b['filters']));if(_0x585e60[_0xc3bf('0x31')][_0xc3bf('0x3d')]){_0x4d2b4a[_0xc3bf('0x3b')]=_[_0xc3bf('0x3e')](_0x4d2b4a[_0xc3bf('0x3b')],{'$or':_[_0xc3bf('0x2f')](_0x4d2b4a[_0xc3bf('0x35')],function(_0x882512){var _0x5ac6b={};_0x5ac6b[_0x882512]={'$like':'%'+_0x585e60['query'][_0xc3bf('0x3d')]+'%'};return _0x5ac6b;})});}_0x4d2b4a=_[_0xc3bf('0x3e')]({},_0x4d2b4a,_0x585e60['options']);return _0x18b331[_0xc3bf('0x52')](_0x4d2b4a);}})[_0xc3bf('0x27')](function(_0x2a9135){if(_0x2a9135){_0x529ec9=_0x2a9135[_0xc3bf('0x37')];if(!_0x585e60['query'][_0xc3bf('0x50')]('nolimit')){_0x4d2b4a['limit']=qs[_0xc3bf('0x20')](_0x585e60[_0xc3bf('0x31')][_0xc3bf('0x20')]);_0x4d2b4a[_0xc3bf('0x1e')]=qs[_0xc3bf('0x1e')](_0x585e60[_0xc3bf('0x31')][_0xc3bf('0x1e')]);}return _0x18b331[_0xc3bf('0x52')](_0x4d2b4a);}})[_0xc3bf('0x27')](function(_0x58ffdf){if(_0x58ffdf){return _0x58ffdf?{'count':_0x529ec9,'rows':_0x58ffdf}:null;}})[_0xc3bf('0x27')](respondWithResult(_0x49d763,null))[_0xc3bf('0x4a')](handleError(_0x49d763,null));};exports[_0xc3bf('0x53')]=function(_0xec631b,_0x11ef32,_0x5caf58){var _0x22e701={};var _0x46214b={};var _0x556a9f;var _0x54feb1;return db[_0xc3bf('0x2b')][_0xc3bf('0x4e')]({'where':{'id':_0xec631b[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x11ef32,null))[_0xc3bf('0x27')](function(_0x2887b5){if(_0x2887b5){_0x556a9f=_0x2887b5;_0x46214b[_0xc3bf('0x2e')]=_[_0xc3bf('0x32')](db[_0xc3bf('0x54')]['rawAttributes']);_0x46214b[_0xc3bf('0x31')]=_[_0xc3bf('0x32')](_0xec631b[_0xc3bf('0x31')]);_0x46214b[_0xc3bf('0x33')]=_[_0xc3bf('0x34')](_0x46214b[_0xc3bf('0x2e')],_0x46214b[_0xc3bf('0x31')]);_0x22e701['attributes']=_['intersection'](_0x46214b[_0xc3bf('0x2e')],qs[_0xc3bf('0x36')](_0xec631b[_0xc3bf('0x31')][_0xc3bf('0x36')]));_0x22e701[_0xc3bf('0x35')]=_0x22e701[_0xc3bf('0x35')][_0xc3bf('0x37')]?_0x22e701['attributes']:_0x46214b[_0xc3bf('0x2e')];_0x22e701['order']=qs['sort'](_0xec631b[_0xc3bf('0x31')]['sort']);_0x22e701[_0xc3bf('0x3b')]=qs[_0xc3bf('0x33')](_[_0xc3bf('0x3c')](_0xec631b[_0xc3bf('0x31')],_0x46214b['filters']));if(_0xec631b['query']['filter']){_0x22e701[_0xc3bf('0x3b')]=_[_0xc3bf('0x3e')](_0x22e701[_0xc3bf('0x3b')],{'$or':_[_0xc3bf('0x2f')](_0x22e701[_0xc3bf('0x35')],function(_0x414376){var _0x51202d={};_0x51202d[_0x414376]={'$like':'%'+_0xec631b['query'][_0xc3bf('0x3d')]+'%'};return _0x51202d;})});}_0x22e701=_[_0xc3bf('0x3e')]({},_0x22e701,_0xec631b[_0xc3bf('0x41')]);return _0x556a9f[_0xc3bf('0x53')](_0x22e701);}})['then'](function(_0x181d35){if(_0x181d35){_0x54feb1=_0x181d35[_0xc3bf('0x37')];if(!_0xec631b[_0xc3bf('0x31')][_0xc3bf('0x50')](_0xc3bf('0x38'))){_0x22e701['limit']=qs[_0xc3bf('0x20')](_0xec631b[_0xc3bf('0x31')][_0xc3bf('0x20')]);_0x22e701['offset']=qs[_0xc3bf('0x1e')](_0xec631b[_0xc3bf('0x31')][_0xc3bf('0x1e')]);}return _0x556a9f[_0xc3bf('0x53')](_0x22e701);}})[_0xc3bf('0x27')](function(_0x3a7dea){if(_0x3a7dea){return _0x3a7dea?{'count':_0x54feb1,'rows':_0x3a7dea}:null;}})['then'](respondWithResult(_0x11ef32,null))[_0xc3bf('0x4a')](handleError(_0x11ef32,null));};exports[_0xc3bf('0x55')]=function(_0x34ae38,_0x335a07,_0x2d855e){if(_0x34ae38[_0xc3bf('0x49')]['id']){delete _0x34ae38[_0xc3bf('0x49')]['id'];}return db[_0xc3bf('0x2b')][_0xc3bf('0x4e')]({'where':{'id':_0x34ae38[_0xc3bf('0x45')]['id']}})[_0xc3bf('0x27')](handleEntityNotFound(_0x335a07,null))[_0xc3bf('0x27')](function(_0x588a92){if(_0x588a92){return _0x588a92[_0xc3bf('0x55')](_0x34ae38[_0xc3bf('0x49')][_0xc3bf('0x56')]||[]);}return null;})[_0xc3bf('0x27')](respondWithResult(_0x335a07,null))[_0xc3bf('0x4a')](handleError(_0x335a07,null));};
\ No newline at end of file
+var _0x79cb=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x5456ea,_0x3cde0c){var _0x1b0077=function(_0x2fad7a){while(--_0x2fad7a){_0x5456ea['push'](_0x5456ea['shift']());}};_0x1b0077(++_0x3cde0c);}(_0x79cb,0x16c));var _0xb79c=function(_0x563891,_0x2ce468){_0x563891=_0x563891-0x0;var _0x2e0167=_0x79cb[_0x563891];return _0x2e0167;};'use strict';var emlformat=require(_0xb79c('0x0'));var rimraf=require(_0xb79c('0x1'));var zipdir=require(_0xb79c('0x2'));var jsonpatch=require(_0xb79c('0x3'));var rp=require(_0xb79c('0x4'));var moment=require(_0xb79c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb79c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb79c('0x7'));var csv=require(_0xb79c('0x8'));var ejs=require(_0xb79c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb79c('0xa'));var crypto=require(_0xb79c('0xb'));var jsforce=require(_0xb79c('0xc'));var deskjs=require(_0xb79c('0xd'));var toCsv=require(_0xb79c('0x8'));var querystring=require(_0xb79c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb79c('0xf'));var authService=require(_0xb79c('0x10'));var qs=require(_0xb79c('0x11'));var as=require(_0xb79c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb79c('0x13'))(_0xb79c('0x14'));var utils=require(_0xb79c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb79c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291b50,_0x551bc2){_0x551bc2=_0x551bc2||0xcc;return function(_0x29bb60){if(_0x29bb60){return _0x291b50[_0xb79c('0x17')](_0x551bc2);}return _0x291b50[_0xb79c('0x18')](_0x551bc2)['end']();};}function respondWithResult(_0x29ce59,_0x135136){_0x135136=_0x135136||0xc8;return function(_0xbc22e2){if(_0xbc22e2){return _0x29ce59['status'](_0x135136)[_0xb79c('0x19')](_0xbc22e2);}};}function respondWithFilteredResult(_0x2a252b,_0x114c5e){return function(_0x3ed0ca){if(_0x3ed0ca){var _0x123e02=typeof _0x114c5e[_0xb79c('0x1a')]===_0xb79c('0x1b')&&typeof _0x114c5e[_0xb79c('0x1c')]==='undefined';var _0x149cd8=_0x3ed0ca[_0xb79c('0x1d')];var _0x42831f=_0x123e02?0x0:_0x114c5e[_0xb79c('0x1a')];var _0x48255a=_0x123e02?_0x3ed0ca['count']:_0x114c5e[_0xb79c('0x1a')]+_0x114c5e['limit'];var _0x2f001c;if(_0x48255a>=_0x149cd8){_0x48255a=_0x149cd8;_0x2f001c=0xc8;}else{_0x2f001c=0xce;}_0x2a252b['status'](_0x2f001c);return _0x2a252b[_0xb79c('0x1e')](_0xb79c('0x1f'),_0x42831f+'-'+_0x48255a+'/'+_0x149cd8)['json'](_0x3ed0ca);}return null;};}function patchUpdates(_0x2012cb){return function(_0x4f57e1){try{jsonpatch['apply'](_0x4f57e1,_0x2012cb,!![]);}catch(_0x32ce38){return BPromise[_0xb79c('0x20')](_0x32ce38);}return _0x4f57e1[_0xb79c('0x21')]();};}function saveUpdates(_0x1b0c21,_0x19b62e){return function(_0x2a5095){if(_0x2a5095){return _0x2a5095[_0xb79c('0x22')](_0x1b0c21)[_0xb79c('0x23')](function(_0x4b3332){return _0x4b3332;});}return null;};}function removeEntity(_0x510c12,_0xc308bb){return function(_0x3cceb1){if(_0x3cceb1){return _0x3cceb1[_0xb79c('0x24')]()[_0xb79c('0x23')](function(){_0x510c12[_0xb79c('0x18')](0xcc)[_0xb79c('0x25')]();});}};}function handleEntityNotFound(_0x1c4f5d,_0x452533){return function(_0x2b1f26){if(!_0x2b1f26){_0x1c4f5d[_0xb79c('0x17')](0x194);}return _0x2b1f26;};}function handleError(_0x2953c1,_0x58a30a){_0x58a30a=_0x58a30a||0x1f4;return function(_0x4c522f){logger['error'](_0x4c522f[_0xb79c('0x26')]);if(_0x4c522f[_0xb79c('0x27')]){delete _0x4c522f[_0xb79c('0x27')];}_0x2953c1[_0xb79c('0x18')](_0x58a30a)['send'](_0x4c522f);};}exports[_0xb79c('0x28')]=function(_0x28576d,_0x9f515e){var _0x41f20c={},_0x4bcbff={},_0x47ea7e={'count':0x0,'rows':[]};var _0x23590f=_['map'](db[_0xb79c('0x29')][_0xb79c('0x2a')],function(_0x33d8ba){return{'name':_0x33d8ba[_0xb79c('0x2b')],'type':_0x33d8ba[_0xb79c('0x2c')][_0xb79c('0x2d')]};});_0x4bcbff[_0xb79c('0x2e')]=_['map'](_0x23590f,_0xb79c('0x27'));_0x4bcbff['query']=_[_0xb79c('0x2f')](_0x28576d['query']);_0x4bcbff[_0xb79c('0x30')]=_[_0xb79c('0x31')](_0x4bcbff[_0xb79c('0x2e')],_0x4bcbff[_0xb79c('0x32')]);_0x41f20c[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x4bcbff[_0xb79c('0x2e')],qs['fields'](_0x28576d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x41f20c[_0xb79c('0x33')]=_0x41f20c['attributes'][_0xb79c('0x35')]?_0x41f20c[_0xb79c('0x33')]:_0x4bcbff['model'];if(!_0x28576d[_0xb79c('0x32')][_0xb79c('0x36')]('nolimit')){_0x41f20c[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x28576d[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x41f20c['offset']=qs[_0xb79c('0x1a')](_0x28576d[_0xb79c('0x32')]['offset']);}_0x41f20c[_0xb79c('0x37')]=qs['sort'](_0x28576d[_0xb79c('0x32')][_0xb79c('0x38')]);_0x41f20c[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x28576d['query'],_0x4bcbff[_0xb79c('0x30')]),_0x23590f);if(_0x28576d[_0xb79c('0x32')]['filter']){_0x41f20c[_0xb79c('0x39')]=_['merge'](_0x41f20c['where'],{'$or':_[_0xb79c('0x3b')](_0x23590f,function(_0x50d173){if(_0x50d173[_0xb79c('0x2c')]!==_0xb79c('0x3c')){var _0x294a3b={};_0x294a3b[_0x50d173['name']]={'$like':'%'+_0x28576d[_0xb79c('0x32')][_0xb79c('0x3d')]+'%'};return _0x294a3b;}})});}_0x41f20c=_[_0xb79c('0x3e')]({},_0x41f20c,_0x28576d[_0xb79c('0x3f')]);var _0x53587c={'where':_0x41f20c[_0xb79c('0x39')]};return db[_0xb79c('0x29')][_0xb79c('0x1d')](_0x53587c)[_0xb79c('0x23')](function(_0xee6b63){_0x47ea7e['count']=_0xee6b63;if(_0x28576d['query'][_0xb79c('0x40')]){_0x41f20c[_0xb79c('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x41f20c);})[_0xb79c('0x23')](function(_0x5080c7){_0x47ea7e['rows']=_0x5080c7;return _0x47ea7e;})[_0xb79c('0x23')](respondWithFilteredResult(_0x9f515e,_0x41f20c))[_0xb79c('0x42')](handleError(_0x9f515e,null));};exports[_0xb79c('0x43')]=function(_0x10c424,_0xfe2ddd){var _0x41f8fd={'raw':![],'where':{'id':_0x10c424[_0xb79c('0x44')]['id']}},_0x249914={};_0x249914[_0xb79c('0x2e')]=_['keys'](db[_0xb79c('0x29')][_0xb79c('0x2a')]);_0x249914[_0xb79c('0x32')]=_['keys'](_0x10c424[_0xb79c('0x32')]);_0x249914[_0xb79c('0x30')]=_['intersection'](_0x249914['model'],_0x249914[_0xb79c('0x32')]);_0x41f8fd[_0xb79c('0x33')]=_['intersection'](_0x249914[_0xb79c('0x2e')],qs['fields'](_0x10c424['query']['fields']));_0x41f8fd[_0xb79c('0x33')]=_0x41f8fd[_0xb79c('0x33')][_0xb79c('0x35')]?_0x41f8fd['attributes']:_0x249914[_0xb79c('0x2e')];if(_0x10c424[_0xb79c('0x32')][_0xb79c('0x40')]){_0x41f8fd['include']=[{'all':!![]}];}_0x41f8fd=_['merge']({},_0x41f8fd,_0x10c424['options']);return db[_0xb79c('0x29')][_0xb79c('0x45')](_0x41f8fd)[_0xb79c('0x23')](handleEntityNotFound(_0xfe2ddd,null))[_0xb79c('0x23')](respondWithResult(_0xfe2ddd,null))[_0xb79c('0x42')](handleError(_0xfe2ddd,null));};exports[_0xb79c('0x46')]=function(_0x290f98,_0x3a1d6a){return db[_0xb79c('0x29')][_0xb79c('0x46')](_0x290f98[_0xb79c('0x47')],{})[_0xb79c('0x23')](respondWithResult(_0x3a1d6a,0xc9))['catch'](handleError(_0x3a1d6a,null));};exports[_0xb79c('0x22')]=function(_0x3bf1d7,_0x9226cc){if(_0x3bf1d7[_0xb79c('0x47')]['id']){delete _0x3bf1d7[_0xb79c('0x47')]['id'];}return db[_0xb79c('0x29')][_0xb79c('0x45')]({'where':{'id':_0x3bf1d7['params']['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x9226cc,null))[_0xb79c('0x23')](saveUpdates(_0x3bf1d7[_0xb79c('0x47')],null))[_0xb79c('0x23')](respondWithResult(_0x9226cc,null))[_0xb79c('0x42')](handleError(_0x9226cc,null));};exports[_0xb79c('0x24')]=function(_0xe17d74,_0xd864fd){return db[_0xb79c('0x29')][_0xb79c('0x45')]({'where':{'id':_0xe17d74[_0xb79c('0x44')]['id']}})['then'](handleEntityNotFound(_0xd864fd,null))[_0xb79c('0x23')](removeEntity(_0xd864fd,null))[_0xb79c('0x42')](handleError(_0xd864fd,null));};exports[_0xb79c('0x48')]=function(_0x2762fd,_0x5ce53f,_0x58edac){var _0x146511={};var _0x17f4cd={};var _0x5399e0;var _0x5341fb;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x2762fd[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x5ce53f,null))['then'](function(_0x9c3973){if(_0x9c3973){_0x5399e0=_0x9c3973;_0x17f4cd[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4a')][_0xb79c('0x2a')]);_0x17f4cd[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x2762fd['query']);_0x17f4cd[_0xb79c('0x30')]=_['intersection'](_0x17f4cd[_0xb79c('0x2e')],_0x17f4cd[_0xb79c('0x32')]);_0x146511['attributes']=_[_0xb79c('0x31')](_0x17f4cd['model'],qs[_0xb79c('0x34')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x34')]));_0x146511['attributes']=_0x146511[_0xb79c('0x33')][_0xb79c('0x35')]?_0x146511[_0xb79c('0x33')]:_0x17f4cd[_0xb79c('0x2e')];_0x146511[_0xb79c('0x37')]=qs['sort'](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x38')]);_0x146511['where']=qs['filters'](_[_0xb79c('0x3a')](_0x2762fd[_0xb79c('0x32')],_0x17f4cd[_0xb79c('0x30')]));if(_0x2762fd['query'][_0xb79c('0x3d')]){_0x146511[_0xb79c('0x39')]=_[_0xb79c('0x3e')](_0x146511[_0xb79c('0x39')],{'$or':_['map'](_0x146511[_0xb79c('0x33')],function(_0x2fbb86){var _0x8927e3={};_0x8927e3[_0x2fbb86]={'$like':'%'+_0x2762fd[_0xb79c('0x32')]['filter']+'%'};return _0x8927e3;})});}_0x146511=_[_0xb79c('0x3e')]({},_0x146511,_0x2762fd[_0xb79c('0x3f')]);return _0x5399e0[_0xb79c('0x48')](_0x146511);}})[_0xb79c('0x23')](function(_0x334f90){if(_0x334f90){_0x5341fb=_0x334f90[_0xb79c('0x35')];if(!_0x2762fd[_0xb79c('0x32')][_0xb79c('0x36')](_0xb79c('0x4b'))){_0x146511['limit']=qs[_0xb79c('0x1c')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x146511[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x1a')]);}return _0x5399e0['getFields'](_0x146511);}})[_0xb79c('0x23')](function(_0x18d69c){if(_0x18d69c){return _0x18d69c?{'count':_0x5341fb,'rows':_0x18d69c}:null;}})['then'](respondWithResult(_0x5ce53f,null))['catch'](handleError(_0x5ce53f,null));};exports['getSubjects']=function(_0x582f0d,_0x6765e9,_0x39c85b){var _0x11ba34={};var _0x368e70={};var _0x441b42;var _0x1bb0eb;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x582f0d[_0xb79c('0x44')]['id']}})['then'](handleEntityNotFound(_0x6765e9,null))[_0xb79c('0x23')](function(_0x2d5a00){if(_0x2d5a00){_0x441b42=_0x2d5a00;_0x368e70[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4a')][_0xb79c('0x2a')]);_0x368e70['query']=_[_0xb79c('0x2f')](_0x582f0d[_0xb79c('0x32')]);_0x368e70['filters']=_[_0xb79c('0x31')](_0x368e70[_0xb79c('0x2e')],_0x368e70[_0xb79c('0x32')]);_0x11ba34[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x368e70[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x582f0d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x11ba34[_0xb79c('0x33')]=_0x11ba34[_0xb79c('0x33')][_0xb79c('0x35')]?_0x11ba34[_0xb79c('0x33')]:_0x368e70['model'];_0x11ba34[_0xb79c('0x37')]=qs[_0xb79c('0x38')](_0x582f0d['query'][_0xb79c('0x38')]);_0x11ba34[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x582f0d['query'],_0x368e70[_0xb79c('0x30')]));if(_0x582f0d[_0xb79c('0x32')][_0xb79c('0x3d')]){_0x11ba34[_0xb79c('0x39')]=_[_0xb79c('0x3e')](_0x11ba34[_0xb79c('0x39')],{'$or':_[_0xb79c('0x3b')](_0x11ba34[_0xb79c('0x33')],function(_0x23122b){var _0x486c18={};_0x486c18[_0x23122b]={'$like':'%'+_0x582f0d['query'][_0xb79c('0x3d')]+'%'};return _0x486c18;})});}_0x11ba34=_[_0xb79c('0x3e')]({},_0x11ba34,_0x582f0d[_0xb79c('0x3f')]);return _0x441b42['getSubjects'](_0x11ba34);}})[_0xb79c('0x23')](function(_0x4310dc){if(_0x4310dc){_0x1bb0eb=_0x4310dc['length'];if(!_0x582f0d[_0xb79c('0x32')][_0xb79c('0x36')]('nolimit')){_0x11ba34[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x582f0d[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x11ba34[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x582f0d[_0xb79c('0x32')]['offset']);}return _0x441b42[_0xb79c('0x4c')](_0x11ba34);}})[_0xb79c('0x23')](function(_0x52aadd){if(_0x52aadd){return _0x52aadd?{'count':_0x1bb0eb,'rows':_0x52aadd}:null;}})[_0xb79c('0x23')](respondWithResult(_0x6765e9,null))[_0xb79c('0x42')](handleError(_0x6765e9,null));};exports['getDescriptions']=function(_0x3efd2d,_0x554ebc,_0x326b86){var _0x369331={};var _0x2ed61d={};var _0x3ae2d3;var _0x31c109;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x3efd2d[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x554ebc,null))[_0xb79c('0x23')](function(_0x267bb3){if(_0x267bb3){_0x3ae2d3=_0x267bb3;_0x2ed61d['model']=_[_0xb79c('0x2f')](db['ZendeskField']['rawAttributes']);_0x2ed61d[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x3efd2d[_0xb79c('0x32')]);_0x2ed61d['filters']=_[_0xb79c('0x31')](_0x2ed61d[_0xb79c('0x2e')],_0x2ed61d[_0xb79c('0x32')]);_0x369331[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x2ed61d[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x369331['attributes']=_0x369331[_0xb79c('0x33')][_0xb79c('0x35')]?_0x369331[_0xb79c('0x33')]:_0x2ed61d[_0xb79c('0x2e')];_0x369331['order']=qs[_0xb79c('0x38')](_0x3efd2d['query'][_0xb79c('0x38')]);_0x369331[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x3efd2d[_0xb79c('0x32')],_0x2ed61d[_0xb79c('0x30')]));if(_0x3efd2d['query'][_0xb79c('0x3d')]){_0x369331['where']=_[_0xb79c('0x3e')](_0x369331[_0xb79c('0x39')],{'$or':_['map'](_0x369331['attributes'],function(_0x4b7524){var _0x15ee2c={};_0x15ee2c[_0x4b7524]={'$like':'%'+_0x3efd2d['query'][_0xb79c('0x3d')]+'%'};return _0x15ee2c;})});}_0x369331=_['merge']({},_0x369331,_0x3efd2d[_0xb79c('0x3f')]);return _0x3ae2d3[_0xb79c('0x4d')](_0x369331);}})[_0xb79c('0x23')](function(_0x25c6cf){if(_0x25c6cf){_0x31c109=_0x25c6cf['length'];if(!_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x36')](_0xb79c('0x4b'))){_0x369331[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x3efd2d[_0xb79c('0x32')]['limit']);_0x369331[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x1a')]);}return _0x3ae2d3[_0xb79c('0x4d')](_0x369331);}})['then'](function(_0x152f1f){if(_0x152f1f){return _0x152f1f?{'count':_0x31c109,'rows':_0x152f1f}:null;}})[_0xb79c('0x23')](respondWithResult(_0x554ebc,null))[_0xb79c('0x42')](handleError(_0x554ebc,null));};exports[_0xb79c('0x4e')]=function(_0x169b6c,_0x434bc6,_0x355111){var _0x2b8a9a={};var _0x4f1524={};var _0x49fa49;var _0x4d075e;return db['ZendeskConfiguration'][_0xb79c('0x49')]({'where':{'id':_0x169b6c[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x434bc6,null))[_0xb79c('0x23')](function(_0x15f5c2){if(_0x15f5c2){_0x49fa49=_0x15f5c2;_0x4f1524[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4f')]['rawAttributes']);_0x4f1524[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x169b6c[_0xb79c('0x32')]);_0x4f1524[_0xb79c('0x30')]=_[_0xb79c('0x31')](_0x4f1524[_0xb79c('0x2e')],_0x4f1524['query']);_0x2b8a9a['attributes']=_[_0xb79c('0x31')](_0x4f1524[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x169b6c['query']['fields']));_0x2b8a9a[_0xb79c('0x33')]=_0x2b8a9a[_0xb79c('0x33')][_0xb79c('0x35')]?_0x2b8a9a[_0xb79c('0x33')]:_0x4f1524[_0xb79c('0x2e')];_0x2b8a9a[_0xb79c('0x37')]=qs[_0xb79c('0x38')](_0x169b6c[_0xb79c('0x32')][_0xb79c('0x38')]);_0x2b8a9a[_0xb79c('0x39')]=qs['filters'](_[_0xb79c('0x3a')](_0x169b6c[_0xb79c('0x32')],_0x4f1524[_0xb79c('0x30')]));if(_0x169b6c['query'][_0xb79c('0x3d')]){_0x2b8a9a[_0xb79c('0x39')]=_['merge'](_0x2b8a9a[_0xb79c('0x39')],{'$or':_[_0xb79c('0x3b')](_0x2b8a9a[_0xb79c('0x33')],function(_0x51fb04){var _0x179b75={};_0x179b75[_0x51fb04]={'$like':'%'+_0x169b6c[_0xb79c('0x32')][_0xb79c('0x3d')]+'%'};return _0x179b75;})});}_0x2b8a9a=_['merge']({},_0x2b8a9a,_0x169b6c['options']);return _0x49fa49[_0xb79c('0x4e')](_0x2b8a9a);}})[_0xb79c('0x23')](function(_0xe4e057){if(_0xe4e057){_0x4d075e=_0xe4e057[_0xb79c('0x35')];if(!_0x169b6c[_0xb79c('0x32')]['hasOwnProperty'](_0xb79c('0x4b'))){_0x2b8a9a[_0xb79c('0x1c')]=qs['limit'](_0x169b6c['query'][_0xb79c('0x1c')]);_0x2b8a9a['offset']=qs[_0xb79c('0x1a')](_0x169b6c['query'][_0xb79c('0x1a')]);}return _0x49fa49[_0xb79c('0x4e')](_0x2b8a9a);}})['then'](function(_0x80db9b){if(_0x80db9b){return _0x80db9b?{'count':_0x4d075e,'rows':_0x80db9b}:null;}})[_0xb79c('0x23')](respondWithResult(_0x434bc6,null))[_0xb79c('0x42')](handleError(_0x434bc6,null));};exports['setTags']=function(_0x5796b0,_0x52986b,_0x2109b6){if(_0x5796b0[_0xb79c('0x47')]['id']){delete _0x5796b0[_0xb79c('0x47')]['id'];}return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x5796b0[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x52986b,null))[_0xb79c('0x23')](function(_0x577f78){if(_0x577f78){return _0x577f78[_0xb79c('0x50')](_0x5796b0[_0xb79c('0x47')][_0xb79c('0x51')]||[]);}return null;})[_0xb79c('0x23')](respondWithResult(_0x52986b,null))[_0xb79c('0x42')](handleError(_0x52986b,null));};
\ No newline at end of file