Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / openchannelInteraction / openchannelInteraction.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xb5c0=['transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','lastName','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','index','map','OpenchannelInteraction','type','key','getOptions','findAll','openchannel','user','catch','show','query','from','params','rawAttributes','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','pick','where','filter','$gte','split','format','options','OpenchannelMessage','include','rows','addTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments'];(function(_0x341e16,_0x5b7929){var _0x5f3224=function(_0x58002c){while(--_0x58002c){_0x341e16['push'](_0x341e16['shift']());}};_0x5f3224(++_0x5b7929);}(_0xb5c0,0x1ad));var _0x0b5c=function(_0x4e62ed,_0x3ba0c0){_0x4e62ed=_0x4e62ed-0x0;var _0x528c21=_0xb5c0[_0x4e62ed];return _0x528c21;};'use strict';var rimraf=require(_0x0b5c('0x0'));var zipdir=require(_0x0b5c('0x1'));var moment=require(_0x0b5c('0x2'));var util=require(_0x0b5c('0x3'));var path=require(_0x0b5c('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x0b5c('0x5'));var interaction=require(_0x0b5c('0x6'));var qs=require(_0x0b5c('0x7'));var pdf=require(_0x0b5c('0x8'));var logger=require(_0x0b5c('0x9'))(_0x0b5c('0xa'));var config=require(_0x0b5c('0xb'));var db=require('../../mysqldb')['db'];config[_0x0b5c('0xc')]=_[_0x0b5c('0xd')](config[_0x0b5c('0xc')],{'host':_0x0b5c('0xe'),'port':0x18eb});var socket=require(_0x0b5c('0xf'))(new Redis(config[_0x0b5c('0xc')]));require(_0x0b5c('0x10'))[_0x0b5c('0x11')](socket);function respondWithStatusCode(_0x1172a0,_0xfe4af){_0xfe4af=_0xfe4af||0xcc;return function(_0x1cb8e6){if(_0x1cb8e6){return _0x1172a0[_0x0b5c('0x12')](_0xfe4af);}return _0x1172a0[_0x0b5c('0x13')](_0xfe4af)[_0x0b5c('0x14')]();};}function respondWithResult(_0x8d7678,_0x11c1bf){_0x11c1bf=_0x11c1bf||0xc8;return function(_0xbf08b9){if(_0xbf08b9){return _0x8d7678['status'](_0x11c1bf)[_0x0b5c('0x15')](_0xbf08b9);}};}function respondWithFilteredResult(_0xbd113b,_0x56fa9b){return function(_0xe638c3){if(_0xe638c3){var _0x559f8c=typeof _0x56fa9b[_0x0b5c('0x16')]===_0x0b5c('0x17')&&typeof _0x56fa9b[_0x0b5c('0x18')]==='undefined';var _0x485d4b=_0xe638c3[_0x0b5c('0x19')];var _0x3a8452=_0x559f8c?0x0:_0x56fa9b[_0x0b5c('0x16')];var _0x221c61=_0x559f8c?_0xe638c3[_0x0b5c('0x19')]:_0x56fa9b[_0x0b5c('0x16')]+_0x56fa9b[_0x0b5c('0x18')];var _0x222e36;if(_0x221c61>=_0x485d4b){_0x221c61=_0x485d4b;_0x222e36=0xc8;}else{_0x222e36=0xce;}_0xbd113b[_0x0b5c('0x13')](_0x222e36);return _0xbd113b[_0x0b5c('0x1a')]('Content-Range',_0x3a8452+'-'+_0x221c61+'/'+_0x485d4b)[_0x0b5c('0x15')](_0xe638c3);}return null;};}function saveUpdates(_0x911d){return function(_0x2a0e5d){if(_0x2a0e5d){return _0x2a0e5d[_0x0b5c('0x1b')](_0x911d)[_0x0b5c('0x1c')](function(_0x5798f7){return _0x5798f7;});}return null;};}function removeEntity(_0x287cb9){return function(_0x424a05){if(_0x424a05){return _0x424a05['destroy']()[_0x0b5c('0x1c')](function(){_0x287cb9[_0x0b5c('0x13')](0xcc)[_0x0b5c('0x14')]();});}};}function handleEntityNotFound(_0x528839){return function(_0x532efa){if(!_0x532efa){_0x528839[_0x0b5c('0x12')](0x194);}return _0x532efa;};}function handleError(_0x5aa2af,_0x7039f8){_0x7039f8=_0x7039f8||0x1f4;return function(_0x476313){logger['error'](_0x476313[_0x0b5c('0x1d')]);if(_0x476313[_0x0b5c('0x1e')]){delete _0x476313[_0x0b5c('0x1e')];}_0x5aa2af[_0x0b5c('0x13')](_0x7039f8)['send'](_0x476313);};}exports[_0x0b5c('0x1f')]=function(_0x49e3be,_0x593a1c){var _0x218694={};var _0x5029b7=_[_0x0b5c('0x20')](db[_0x0b5c('0x21')]['rawAttributes'],function(_0x498330){return{'name':_0x498330['fieldName'],'type':_0x498330[_0x0b5c('0x22')][_0x0b5c('0x23')]};});_0x218694=qs[_0x0b5c('0x24')](_0x5029b7,_0x49e3be);return interaction[_0x0b5c('0x25')](_0x0b5c('0x26'),_0x49e3be['query'],_0x49e3be[_0x0b5c('0x27')],_0x218694,_0x5029b7)['then'](respondWithFilteredResult(_0x593a1c,_0x218694))[_0x0b5c('0x28')](handleError(_0x593a1c,null));};exports[_0x0b5c('0x29')]=function(_0x2d17b2,_0xb41269){var _0xd30c03={};if(_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x22')]&&_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x22')]==='from'){_0xd30c03[_0x0b5c('0x2b')]=_0x2d17b2[_0x0b5c('0x2c')]['id'];}else{_0xd30c03['id']=_0x2d17b2[_0x0b5c('0x2c')]['id'];}var _0x1aa63c={'raw':![],'where':_0xd30c03},_0x441906={};_0x441906['model']=_['keys'](db[_0x0b5c('0x21')][_0x0b5c('0x2d')]);_0x441906[_0x0b5c('0x2a')]=_[_0x0b5c('0x2e')](_0x2d17b2[_0x0b5c('0x2a')]);_0x441906[_0x0b5c('0x2f')]=_[_0x0b5c('0x30')](_0x441906[_0x0b5c('0x31')],_0x441906[_0x0b5c('0x2a')]);_0x1aa63c[_0x0b5c('0x32')]=_[_0x0b5c('0x30')](_0x441906[_0x0b5c('0x31')],qs[_0x0b5c('0x33')](_0x2d17b2[_0x0b5c('0x2a')]['fields']));_0x1aa63c[_0x0b5c('0x32')]=_0x1aa63c['attributes'][_0x0b5c('0x34')]?_0x1aa63c[_0x0b5c('0x32')]:_0x441906[_0x0b5c('0x31')];if(_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x35')]){_0x1aa63c['include']=[{'all':!![]}];}_0x1aa63c=_[_0x0b5c('0x36')]({},_0x1aa63c,_0x2d17b2['options']);return db[_0x0b5c('0x21')][_0x0b5c('0x37')](_0x1aa63c)[_0x0b5c('0x1c')](handleEntityNotFound(_0xb41269,null))[_0x0b5c('0x1c')](respondWithResult(_0xb41269,null))[_0x0b5c('0x28')](handleError(_0xb41269,null));};exports[_0x0b5c('0x38')]=function(_0x56c9f5,_0x51a1b9){return db[_0x0b5c('0x21')][_0x0b5c('0x38')](_0x56c9f5['body'],{})[_0x0b5c('0x1c')](respondWithResult(_0x51a1b9,0xc9))[_0x0b5c('0x28')](handleError(_0x51a1b9,null));};exports['update']=function(_0x289e78,_0x2b1280){if(_0x289e78['body']['id']){delete _0x289e78[_0x0b5c('0x39')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x289e78[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x2b1280,null))[_0x0b5c('0x1c')](saveUpdates(_0x289e78[_0x0b5c('0x39')],null))[_0x0b5c('0x1c')](respondWithResult(_0x2b1280,null))['catch'](handleError(_0x2b1280,null));};exports[_0x0b5c('0x3a')]=function(_0x51fd2b,_0x193a6b){return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0x51fd2b[_0x0b5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x193a6b,null))[_0x0b5c('0x1c')](removeEntity(_0x193a6b,null))['catch'](handleError(_0x193a6b,null));};exports[_0x0b5c('0x3b')]=function(_0x962d31,_0xe52698){return db[_0x0b5c('0x21')]['describe']()[_0x0b5c('0x1c')](respondWithResult(_0xe52698,null))['catch'](handleError(_0xe52698,null));};exports[_0x0b5c('0x3c')]=function(_0x505643,_0x4ca7d5){return db['OpenchannelMessage'][_0x0b5c('0x37')]({'where':{'id':_0x505643[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x4ca7d5,null))['then'](function(_0x56e971){if(_0x56e971){return _0x56e971[_0x0b5c('0x3c')](_0x505643[_0x0b5c('0x39')][_0x0b5c('0x3d')],_[_0x0b5c('0x3e')](_0x505643['body'],['ids','id'])||{});}})[_0x0b5c('0x1c')](respondWithResult(_0x4ca7d5,null))[_0x0b5c('0x28')](handleError(_0x4ca7d5,null));};exports[_0x0b5c('0x3f')]=function(_0x59b0e2,_0x314ba4){var _0x1807bb={'raw':![],'where':{}};var _0x26867c={};var _0x2a0416={'count':0x0,'rows':[]};return db[_0x0b5c('0x21')][_0x0b5c('0x40')]({'where':{'id':_0x59b0e2[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x314ba4,null))[_0x0b5c('0x1c')](function(_0x3cb30a){if(_0x3cb30a){_0x26867c[_0x0b5c('0x31')]=_['keys'](db['OpenchannelMessage'][_0x0b5c('0x2d')]);_0x26867c[_0x0b5c('0x2a')]=_[_0x0b5c('0x2e')](_0x59b0e2['query']);_0x26867c[_0x0b5c('0x2f')]=_[_0x0b5c('0x30')](_0x26867c[_0x0b5c('0x31')],_0x26867c[_0x0b5c('0x2a')]);_0x1807bb[_0x0b5c('0x32')]=_[_0x0b5c('0x30')](_0x26867c[_0x0b5c('0x31')],qs['fields'](_0x59b0e2[_0x0b5c('0x2a')]['fields']));_0x1807bb[_0x0b5c('0x32')]=_0x1807bb['attributes'][_0x0b5c('0x34')]?_0x1807bb['attributes']:_0x26867c[_0x0b5c('0x31')];if(!_0x59b0e2['query'][_0x0b5c('0x41')]('nolimit')){_0x1807bb[_0x0b5c('0x18')]=qs[_0x0b5c('0x18')](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x18')]);_0x1807bb['offset']=qs['offset'](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x16')]);}_0x1807bb[_0x0b5c('0x42')]=qs[_0x0b5c('0x43')](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x43')]);_0x1807bb['where']=qs[_0x0b5c('0x2f')](_[_0x0b5c('0x44')](_0x59b0e2[_0x0b5c('0x2a')],_0x26867c[_0x0b5c('0x2f')]));_0x1807bb[_0x0b5c('0x45')]['OpenchannelInteractionId']=_0x3cb30a['id'];if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x46')]){_0x1807bb[_0x0b5c('0x45')]=_[_0x0b5c('0x36')](_0x1807bb['where'],{'$or':_[_0x0b5c('0x20')](_0x1807bb[_0x0b5c('0x32')],function(_0x3e078d){var _0x257d14={};_0x257d14[_0x3e078d]={'$like':'%'+_0x59b0e2['query'][_0x0b5c('0x46')]+'%'};return _0x257d14;})});}if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x47')]){var _0x2f3445=_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x47')][_0x0b5c('0x48')](',');var _0x409407={};_0x409407[_0x2f3445[0x0]]={'$gte':moment(_0x2f3445[0x1])[_0x0b5c('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1807bb['where']=_['merge'](_0x1807bb['where'],_0x409407);}_0x1807bb=_[_0x0b5c('0x36')]({},_0x1807bb,_0x59b0e2[_0x0b5c('0x4a')]);return db[_0x0b5c('0x4b')]['count']({'where':_0x1807bb['where']})['then'](function(_0x972c31){_0x2a0416[_0x0b5c('0x19')]=_0x972c31;if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x35')]){_0x1807bb[_0x0b5c('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0b5c('0x25')](_0x1807bb);})[_0x0b5c('0x1c')](function(_0x265f74){_0x2a0416[_0x0b5c('0x4d')]=_0x265f74;return _0x2a0416;});}})['then'](respondWithFilteredResult(_0x314ba4,_0x1807bb))[_0x0b5c('0x28')](handleError(_0x314ba4,null));};exports[_0x0b5c('0x4e')]=function(_0x5af1cc,_0x5d9e87){return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0x5af1cc[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x5d9e87,null))[_0x0b5c('0x1c')](function(_0x329fc6){if(_0x329fc6){return _0x329fc6['setTags'](_0x5af1cc['body']['ids'],_[_0x0b5c('0x3e')](_0x5af1cc['body'],[_0x0b5c('0x3d'),'id'])||{})['spread'](function(){return db[_0x0b5c('0x4f')][_0x0b5c('0x25')]({'attributes':['id',_0x0b5c('0x1e'),'color'],'where':{'id':_0x5af1cc[_0x0b5c('0x39')][_0x0b5c('0x3d')]}});})['then'](function(_0x1a8e48){socket[_0x0b5c('0x50')](_0x0b5c('0x51'),{'id':Number(_0x5af1cc[_0x0b5c('0x2c')]['id']),'tags':_0x1a8e48||[]});return{'id':Number(_0x5af1cc[_0x0b5c('0x2c')]['id']),'tags':_0x1a8e48||[]};});}})[_0x0b5c('0x1c')](respondWithResult(_0x5d9e87,null))[_0x0b5c('0x28')](handleError(_0x5d9e87,null));};exports[_0x0b5c('0x52')]=function(_0x4ebb05,_0x5d3724){return db['OpenchannelInteraction'][_0x0b5c('0x37')]({'where':{'id':_0x4ebb05[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x5d3724,null))[_0x0b5c('0x1c')](function(_0x2aa968){if(_0x2aa968){return _0x2aa968[_0x0b5c('0x52')](_0x4ebb05[_0x0b5c('0x2a')][_0x0b5c('0x3d')]);}})[_0x0b5c('0x1c')](respondWithStatusCode(_0x5d3724,null))[_0x0b5c('0x28')](handleError(_0x5d3724,null));};exports[_0x0b5c('0x53')]=function(_0xef070a,_0x571a39){var _0xc819f5=moment()[_0x0b5c('0x54')]()[_0x0b5c('0x55')]();var _0x44d404=path[_0x0b5c('0x56')](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x59'),'tmp');var _0xf90168=path[_0x0b5c('0x56')](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x59'),_0x0b5c('0x5a'));var _0x4381ad=path[_0x0b5c('0x56')](_0x44d404,_0xc819f5);var _0x15ca7a=util[_0x0b5c('0x49')](_0x0b5c('0x5b'),_0xef070a['params']['id'],_0xc819f5);var _0x53c6bd=path[_0x0b5c('0x56')](_0x44d404,_0x15ca7a);var _0x336140=[];_0x336140['push']({'model':db[_0x0b5c('0x5c')],'as':'User','attributes':['id',_0x0b5c('0x5d')],'raw':!![]});_0x336140[_0x0b5c('0x5e')]({'model':db['CmContact'],'as':_0x0b5c('0x5f'),'attributes':['id',_0x0b5c('0x60'),'lastName'],'raw':!![]});if(_0xef070a[_0x0b5c('0x2a')][_0x0b5c('0x5a')]){_0x336140[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x61')],'as':_0x0b5c('0x61'),'raw':!![]});}var _0x436b03=[{'model':db[_0x0b5c('0x4b')],'as':_0x0b5c('0x62'),'attributes':['id',_0x0b5c('0x39'),_0x0b5c('0x63'),_0x0b5c('0x64'),_0x0b5c('0x65'),_0x0b5c('0x66')],'include':_0x336140}];_0x436b03[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x67')],'as':_0x0b5c('0x68'),'attributes':['id',_0x0b5c('0x1e')]});_0x436b03[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x5c')],'as':_0x0b5c('0x69'),'attributes':['id',_0x0b5c('0x5d')]});return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0xef070a[_0x0b5c('0x2c')]['id']},'include':_0x436b03})['then'](handleEntityNotFound(_0x571a39,null))[_0x0b5c('0x1c')](function(_0x470dbc){if(_0x470dbc){var _0x3ca102=_0x470dbc[_0x0b5c('0x6a')]({'plain':!![]});fs[_0x0b5c('0x6b')](_0x4381ad);var _0x3bc028={'channel':_0x0b5c('0x6c'),'account':_0x3ca102['Account']['name'],'agent':_0x3ca102[_0x0b5c('0x69')]?_0x3ca102[_0x0b5c('0x69')][_0x0b5c('0x5d')]:'N.A.','createdAt':moment(_0x3ca102['createdAt'])[_0x0b5c('0x49')](_0x0b5c('0x6d'))[_0x0b5c('0x55')](),'closedAt':_0x3ca102['closed']?moment(_0x3ca102[_0x0b5c('0x6e')])['format'](_0x0b5c('0x6d'))['toString']():'','disposition':_0x3ca102[_0x0b5c('0x6f')],'visibility':_0x3ca102[_0x0b5c('0x70')]?_0x0b5c('0x71'):_0x0b5c('0x72'),'messages':_(_0x3ca102[_0x0b5c('0x62')])[_0x0b5c('0x46')]({'secret':![]})[_0x0b5c('0x20')](function(_0x2b3923){if(_0x2b3923[_0x0b5c('0x61')]){var _0x3c1114=path['join'](_0xf90168,_0x2b3923[_0x0b5c('0x61')][_0x0b5c('0x73')]);if(fs['existsSync'](_0x3c1114)){fs[_0x0b5c('0x74')](_0x3c1114)[_0x0b5c('0x75')](fs[_0x0b5c('0x76')](path[_0x0b5c('0x56')](_0x4381ad,_0x2b3923[_0x0b5c('0x61')][_0x0b5c('0x73')])));}}return{'date':moment(_0x2b3923[_0x0b5c('0x63')])[_0x0b5c('0x49')](_0x0b5c('0x6d'))['toString'](),'sender':_0x2b3923[_0x0b5c('0x64')]==='out'?_0x2b3923[_0x0b5c('0x5c')]?_0x2b3923[_0x0b5c('0x5c')][_0x0b5c('0x5d')]:_0x0b5c('0x77'):_0x2b3923[_0x0b5c('0x5f')][_0x0b5c('0x60')]+(_0x2b3923[_0x0b5c('0x5f')][_0x0b5c('0x78')]?'\x20'+_0x2b3923['Contact'][_0x0b5c('0x78')]:''),'body':_0x2b3923[_0x0b5c('0x61')]?_0x2b3923[_0x0b5c('0x61')]['basename']:_0x2b3923[_0x0b5c('0x39')],'direction':_0x2b3923[_0x0b5c('0x64')]===_0x0b5c('0x79')?'A':'C','secret':_0x2b3923[_0x0b5c('0x65')],'read':_0x2b3923[_0x0b5c('0x66')],'attachment':_0x2b3923[_0x0b5c('0x61')]};})['value']()};return ejs[_0x0b5c('0x7a')](path['join'](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x7b'),_0x0b5c('0x7c')),{'interaction':_0x3bc028})[_0x0b5c('0x1c')](function(_0x23a6e9){var _0x4a9f31=path[_0x0b5c('0x56')](_0x4381ad,'transcript-'+_0x3ca102['id']+'-'+_0xc819f5+_0x0b5c('0x7d'));var _0x3e3da4={'path':_0x4a9f31,'channel':_0x0b5c('0x6c'),'interactionId':_0x3ca102['id']};return pdf[_0x0b5c('0x7e')](_0x23a6e9,_0x3e3da4);})[_0x0b5c('0x1c')](function(){return new Promise(function(_0x413bca,_0x1b161b){zipdir(_0x4381ad,{'saveTo':_0x53c6bd},function(_0x46a4fb,_0x28a2c1){if(_0x46a4fb)return _0x1b161b(_0x46a4fb);return _0x413bca(_0x28a2c1);});})[_0x0b5c('0x1c')](function(){return new Promise(function(_0x3034d4,_0x3bd988){rimraf(_0x4381ad,function(_0xbb73a0){if(_0xbb73a0)_0x3bd988(_0xbb73a0);return _0x3034d4();});});})[_0x0b5c('0x1c')](function(){return _0x571a39['download'](_0x53c6bd,_0x15ca7a,function(_0x268ecf){if(_0x268ecf){logger[_0x0b5c('0x7f')](_0x0b5c('0x80'),_0x268ecf);}else{fs[_0x0b5c('0x81')](_0x53c6bd);}});});});}else{return _0x571a39[_0x0b5c('0x12')](0xc8);}})[_0x0b5c('0x28')](handleError(_0x571a39,null));};