ad80d244e74907f4946829a8d60da9061d897ffa
[motion.git] / server / config / integrations / zendesk.js
1 var _0x6743=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x75\x72\x6C","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x5A\x65\x6E\x64\x65\x73\x6B\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x55\x73\x65\x72","\x5A\x65\x6E\x64\x65\x73\x6B\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x69\x6E\x66\x6F","\x68\x61\x6E\x64\x6C\x65\x45\x76\x65\x6E\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x50\x61\x73\x73\x65\x64\x20\x70\x61\x72\x61\x6D\x65\x74\x65\x72\x73\x20\x61\x72\x65\x20\x6E\x6F\x74\x20\x65\x6E\x6F\x75\x67\x68\x20\x74\x6F\x20\x63\x72\x65\x61\x74\x65\x20\x61\x20\x6E\x65\x77\x20\x74\x69\x63\x6B\x65\x74\x3A\x20\x6D\x69\x73\x73\x20\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64\x20\x6F\x72\x20\x43\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E\x49\x64","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64","\x63\x6F\x6E\x66\x69\x67\x75\x72\x61\x74\x69\x6F\x6E","\x75\x72\x69","\x68\x65\x61\x64\x65\x72\x73","\x73\x65\x72\x76\x65\x72\x55\x52\x4C","\x73\x65\x72\x76\x65\x72\x55\x72\x6C","\x5A\x65\x6E\x64\x65\x73\x6B\x41\x63\x63\x6F\x75\x6E\x74","\x72\x65\x6D\x6F\x74\x65\x55\x72\x69","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x61\x67\x65\x6E\x74\x4E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x6E\x61\x6D\x65","\x6D\x6F\x6E\x69\x74\x6F\x72\x5F\x66\x6F\x72\x6D\x61\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x51\x75\x65\x75\x65","\x72\x65\x63\x6F\x72\x64\x45\x6E\x61\x62\x6C\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x51\x75\x65\x75\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x72\x6F\x75\x74\x65\x49\x64","\x69\x64","\x72\x65\x63\x6F\x72\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x65\x6E\x61\x62\x6C\x65\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x52\x6F\x75\x74\x65\x20\x4F\x75\x74\x62\x6F\x75\x6E\x64\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x6F\x72\x20\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x65\x6E\x61\x62\x6C\x65\x64","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6A\x73\x6F\x6E","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x61\x75\x74\x68\x54\x79\x70\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x3A","\x74\x6F\x6B\x65\x6E","\x2F\x74\x6F\x6B\x65\x6E\x3A","\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x42\x61\x73\x69\x63\x20","\x62\x61\x73\x65\x36\x34","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x2F\x73\x65\x61\x72\x63\x68\x2E\x6A\x73\x6F\x6E","\x74\x79\x70\x65\x3A\x75\x73\x65\x72\x20\x72\x6F\x6C\x65\x3A\x61\x67\x65\x6E\x74\x20\x6E\x61\x6D\x65\x3A\x25\x73","\x66\x6F\x72\x6D\x61\x74","","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x76\x6F\x69\x63\x65","\x43\x68\x61\x6E\x6E\x65\x6C\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64\x3A","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x55\x52\x4C","\x25\x73\x2F\x61\x70\x69\x2F\x76\x6F\x69\x63\x65\x2F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73\x2F\x25\x73\x2F\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x3F\x74\x79\x70\x65\x3D\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x72\x65\x73\x75\x6C\x74","\x6C\x65\x6E\x67\x74\x68","\x72\x65\x73\x75\x6C\x74\x73","\x63\x6F\x75\x6E\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x66\x69\x72\x73\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x67\x65\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2E\x20\x55\x73\x65\x20\x74\x68\x65\x20\x61\x64\x6D\x69\x6E\x20\x61\x63\x63\x6F\x75\x6E\x74","\x2F\x75\x73\x65\x72\x73\x2F\x6D\x65\x2E\x6A\x73\x6F\x6E","\x75\x73\x65\x72","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x41\x64\x6D\x69\x6E\x20\x73\x65\x6C\x65\x63\x74\x65\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x74\x6F\x20\x73\x65\x61\x72\x63\x68\x3A","\x74\x79\x70\x65\x3A\x75\x73\x65\x72\x20\x72\x6F\x6C\x65\x3A\x65\x6E\x64\x2D\x75\x73\x65\x72\x20\x25\x73\x3A\x25\x73","\x70\x68\x6F\x6E\x65","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x66\x6F\x75\x6E\x64\x3A","\x65\x6E\x64\x75\x73\x65\x72","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x64\x65\x62\x75\x67","\x2F\x75\x73\x65\x72\x73\x2E\x6A\x73\x6F\x6E","\x50\x4F\x53\x54","\x65\x6E\x64\x2D\x75\x73\x65\x72","\x43\x61\x6C\x6C\x65\x72\x20\x2D\x20\x25\x73","\x3C\x75\x6E\x6B\x6E\x6F\x77\x6E\x3E","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x6E\x64\x20\x55\x73\x65\x72\x20\x63\x72\x65\x61\x74\x65\x64\x3A","\x76\x61\x6C\x75\x65","\x66\x6F\x72\x45\x61\x63\x68","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x62\x6F\x64\x79\x3A","\x2F\x74\x69\x63\x6B\x65\x74\x73\x2E\x6A\x73\x6F\x6E","\x54\x61\x67\x73","\x6D\x61\x70","\x53\x75\x62\x6A\x65\x63\x74","\x73\x6F\x72\x74\x42\x79","\x74\x79\x70\x65","\x73\x74\x72\x69\x6E\x67","\x63\x6F\x6E\x74\x65\x6E\x74","\x70\x75\x73\x68","\x76\x61\x72\x69\x61\x62\x6C\x65","\x76\x61\x72\x69\x61\x62\x6C\x65\x4E\x61\x6D\x65","\x63\x75\x73\x74\x6F\x6D\x56\x61\x72\x69\x61\x62\x6C\x65","\x56\x61\x72\x69\x61\x62\x6C\x65","\x20","\x6A\x6F\x69\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x6B\x65\x79\x56\x61\x6C\x75\x65","\x6B\x65\x79\x54\x79\x70\x65","\x6B\x65\x79","\x25\x73\x3A\x20\x25\x73","\x6B\x65\x79\x43\x6F\x6E\x74\x65\x6E\x74","\x0A","\x46\x69\x65\x6C\x64","\x66\x69\x6C\x74\x65\x72","\x69\x64\x46\x69\x65\x6C\x64","\x6E\x61\x6D\x65\x46\x69\x65\x6C\x64","\x74\x69\x63\x6B\x65\x74","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x61\x62","\x2F\x63\x68\x61\x6E\x6E\x65\x6C\x73\x2F\x76\x6F\x69\x63\x65\x2F\x61\x67\x65\x6E\x74\x73\x2F\x25\x64\x2F\x74\x69\x63\x6B\x65\x74\x73\x2F\x25\x64\x2F\x64\x69\x73\x70\x6C\x61\x79\x2E\x6A\x73\x6F\x6E","\x70\x61\x72\x73\x65","\x70\x61\x74\x68","\x73\x65\x61\x72\x63\x68","\x68\x72\x65\x66","\x71\x75\x65\x72\x79","\x70\x61\x74\x68\x6E\x61\x6D\x65","\x74\x61\x62\x55\x72\x6C","\x25\x73\x2F\x61\x67\x65\x6E\x74\x2F\x74\x69\x63\x6B\x65\x74\x73\x2F\x25\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x7A\x65\x6E\x64\x65\x73\x6B","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x65\x78\x69\x74\x53\x74\x61\x74\x75\x73","\x73\x75\x63\x63\x65\x73\x73","\x74\x69\x63\x6B\x65\x74\x49\x64","\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x49\x64","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x3A\x7A\x65\x6E\x64\x65\x73\x6B","\x65\x6D\x69\x74","\x61\x67\x65\x6E\x74\x3A\x25\x73","\x74\x6F","\x63\x72\x65\x61\x74\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x54\x69\x63\x6B\x65\x74\x20\x25\x64\x20\x25\x73\x20\x74\x6F\x20\x61\x67\x65\x6E\x74\x20\x25\x64","\x6F\x70\x65\x6E\x65\x64","\x64\x69\x73\x70\x6C\x61\x79\x65\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x74\x69\x63\x6B\x65\x74\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\x66\x61\x69\x6C\x65\x64","\x5B\x5A\x65\x6E\x64\x65\x73\x6B\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x52\x65\x70\x6F\x72\x74\x20\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x20\x63\x72\x65\x61\x74\x65","\x73\x75\x62\x73\x74\x72","\x2F","\x65\x78\x70\x6F\x72\x74\x73"];_0x6743[0];var _=require(_0x6743[1]);var util=require(_0x6743[2]);var url=require(_0x6743[3]);var rp=require(_0x6743[4]);var logger=require(_0x6743[6])(_0x6743[5]);var ZendeskConfiguration=require(_0x6743[8])[_0x6743[7]];var ReportIntegration=require(_0x6743[8])[_0x6743[9]];var VoiceQueue=require(_0x6743[8])[_0x6743[10]];var VoiceExtension=require(_0x6743[8])[_0x6743[11]];var Agent=require(_0x6743[8])[_0x6743[12]];function Zendesk(){logger[_0x6743[14]](_0x6743[13])}Zendesk[_0x6743[16]][_0x6743[15]]= function(_0x517dxc,_0x517dxd,_0x517dxe,_0x517dxf,_0x517dx10,_0x517dx11,_0x517dx12){var _0x517dx13={uri:undefined,headers:undefined,agent:undefined,enduser:undefined,ticket:undefined,configuration:undefined,recordEnable:false,serverURL:undefined,agentName:undefined,tabUrl:undefined};if(!_0x517dxc||  !_0x517dxd){logger[_0x6743[18]](_0x6743[17]);return};ZendeskConfiguration[_0x6743[21]]({where:{id:_0x517dxd,AccountId:_0x517dxc},include:[{all:true,include:[{all:true}]}]})[_0x6743[20]](handleEntityNotFound())[_0x6743[20]](handleConnection(_0x517dx13))[_0x6743[20]](searchMotionAgent(_0x517dxe,_0x517dx10))[_0x6743[20]](handleMotionAgent(_0x517dx13))[_0x6743[20]](searchQueue(_0x517dx10))[_0x6743[20]](handleQueueRecordings(_0x517dx13,_0x517dx10))[_0x6743[20]](searchRoute(_0x517dx10))[_0x6743[20]](handleOutboundRecordings(_0x517dx13,_0x517dx10))[_0x6743[20]](searchAgent(_0x517dx13))[_0x6743[20]](handleAgent(_0x517dx13))[_0x6743[20]](searchAdmin(_0x517dx13))[_0x6743[20]](handleAdmin(_0x517dx13))[_0x6743[20]](searchEndUser(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxf))[_0x6743[20]](handleEndUser(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxf))[_0x6743[20]](endUserCreation(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxf))[_0x6743[20]](handleEndUserCreation(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxf))[_0x6743[20]](ticketCreation(_0x517dx13,_0x517dx10,_0x517dx11))[_0x6743[20]](handleTicketDisplay(_0x517dx13))[_0x6743[20]](handleReportIntegration(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxc,_0x517dxf,_0x517dx12))[_0x6743[20]](handleEnd(_0x517dx13))[_0x6743[19]](handleError(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxc))};function handleEntityNotFound(){return function(_0x517dx15){if(!_0x517dx15){return null};return _0x517dx15}}function handleConnection(_0x517dx13){return function(_0x517dx17){var _0x517dx18=getAccountConfiguration(_0x517dx17.ZendeskAccount);_0x517dx13[_0x6743[22]]= _0x517dx17;_0x517dx13[_0x6743[23]]= _0x517dx18[_0x6743[23]];_0x517dx13[_0x6743[24]]= _0x517dx18[_0x6743[24]];_0x517dx13[_0x6743[25]]= _0x517dx17[_0x6743[27]][_0x6743[26]];_0x517dx13[_0x6743[28]]= _0x517dx17[_0x6743[27]][_0x6743[28]]}}function searchMotionAgent(_0x517dxe,_0x517dx10){return function(){var _0x517dx1a=getAgentSearchPropertyFromChannel(_0x517dxe);if(_0x517dx10[_0x6743[29]](_0x517dx1a)){return Agent[_0x6743[33]](_0x6743[32])[_0x6743[31]]({where:{name:getValueFromPropertyName(_0x517dx10,_0x517dx1a)},attributes:[_0x6743[30]]})};return}}function handleMotionAgent(_0x517dx13){return function(_0x517dx1c){if(_0x517dx1c&& _0x517dx1c[_0x6743[30]]){_0x517dx13[_0x6743[34]]= _0x517dx1c[_0x6743[30]]};return}}function searchQueue(_0x517dx10){return function(){if(_0x517dx10[_0x6743[35]]){return VoiceQueue[_0x6743[31]]({where:{name:_0x517dx10[_0x6743[35]]},attributes:[_0x6743[36],_0x6743[37]]})}else {return}}}function handleQueueRecordings(_0x517dx13,_0x517dx10){return function(_0x517dx1f){if(_0x517dx10[_0x6743[35]]){if(_0x517dx1f&& _0x517dx1f[_0x6743[37]]){logger[_0x6743[14]](_0x6743[38],_0x517dx1f[_0x6743[36]]);_0x517dx13[_0x6743[39]]= true}else {_0x517dx13[_0x6743[39]]= false;logger[_0x6743[14]](_0x6743[40])}};return}}function searchRoute(_0x517dx10){return function(){if(_0x517dx10[_0x6743[41]]){return VoiceExtension[_0x6743[31]]({where:{id:_0x517dx10[_0x6743[41]]},attributes:[_0x6743[42],_0x6743[43]]})}else {return}}}function handleOutboundRecordings(_0x517dx13,_0x517dx10){return function(_0x517dx22){if(_0x517dx10[_0x6743[41]]){if(_0x517dx22&& _0x517dx22[_0x6743[43]]){logger[_0x6743[14]](_0x6743[44],_0x517dx22[_0x6743[42]]);_0x517dx13[_0x6743[39]]= true}else {_0x517dx13[_0x6743[39]]= false;logger[_0x6743[14]](_0x6743[45])}};return}}function getAccountConfiguration(_0x517dx24){var _0x517dx25={uri:stripTrailingSlash(_0x517dx24[_0x6743[28]]),headers:{"\x41\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E":undefined,"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x6743[46],"\x41\x63\x63\x65\x70\x74":_0x6743[46]}};var _0x517dx26=_0x517dx24[_0x6743[47]];if(_0x517dx24[_0x6743[48]]=== _0x6743[49]){_0x517dx26= _0x517dx26+ _0x6743[50]+ _0x517dx24[_0x6743[49]]}else {if(_0x517dx24[_0x6743[48]]=== _0x6743[51]){_0x517dx26= _0x517dx26+ _0x6743[52]+ _0x517dx24[_0x6743[51]]}};_0x517dx25[_0x6743[24]][_0x6743[53]]= _0x6743[54]+  new Buffer(_0x517dx26).toString(_0x6743[55]);return _0x517dx25}function searchAgent(_0x517dx13){return function(){if(_0x517dx13[_0x6743[34]]){logger[_0x6743[14]](_0x6743[56],_0x517dx13[_0x6743[34]]);return rp({uri:_0x517dx13[_0x6743[23]]+ _0x6743[57],qs:{"\x71\x75\x65\x72\x79":util[_0x6743[59]](_0x6743[58],_0x517dx13[_0x6743[34]])},headers:_0x517dx13[_0x6743[24]],json:true})};return}}function getAgentSearchPropertyFromChannel(_0x517dxe){var _0x517dx29=_0x6743[60];if(_0x517dxe){switch(_0x517dxe){case _0x6743[62]:_0x517dx29= _0x6743[61];break;default:_0x517dx29= _0x6743[61];logger[_0x6743[18]](_0x6743[63],_0x517dxe)}};return _0x517dx29}function getValueFromPropertyName(_0x517dx10,_0x517dx29,_0x517dx13){if(_0x517dx29=== _0x6743[64]){if(_0x517dx13&& _0x517dx13[_0x6743[39]]&& _0x517dx13[_0x6743[25]]){return util[_0x6743[59]](_0x6743[65],stripTrailingSlash(_0x517dx13[_0x6743[25]]),_0x517dx10[_0x6743[66]])}else {return null}}else {return _[_0x6743[67]](_0x517dx10,_0x517dx29)}}function handleAgent(_0x517dx13){return function(_0x517dx10){if(_0x517dx10&& _0x517dx10[_0x6743[69]][_0x6743[68]]> 0&& _0x517dx10[_0x6743[70]]> 0){logger[_0x6743[14]](_0x6743[71],_0x517dx13[_0x6743[34]]);_0x517dx13[_0x6743[32]]= getMatchObject(_0x517dx10[_0x6743[69]],_0x6743[36],_0x517dx13[_0x6743[34]]);return _0x517dx13[_0x6743[32]]};return}}function getMatchObject(_0x517dx2d,_0x517dx29,_0x517dx2e){var _0x517dx2f=_[_0x6743[21]](_0x517dx2d,{property:_0x517dx2e});if(_0x517dx2f){return _0x517dx2f};return _[_0x6743[72]](_0x517dx2d)}function searchAdmin(_0x517dx13){return function(_0x517dx10){if(_0x517dx10){return};logger[_0x6743[14]](_0x6743[73]);return rp({uri:_0x517dx13[_0x6743[23]]+ _0x6743[74],headers:_0x517dx13[_0x6743[24]],json:true})}}function handleAdmin(_0x517dx13){return function(_0x517dx10){if(!_0x517dx10){return};if(_0x517dx10[_0x6743[75]]){logger[_0x6743[14]](_0x6743[76]);_0x517dx13[_0x6743[32]]= _0x517dx10[_0x6743[75]]};return}}function searchEndUser(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxf){return function(){logger[_0x6743[14]](_0x6743[77],getValueFromPropertyName(_0x517dx10,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)));return rp({uri:_0x517dx13[_0x6743[23]]+ _0x6743[57],qs:{"\x71\x75\x65\x72\x79":util[_0x6743[59]](_0x6743[78],getEndUserSearchQueryFromChannel(_0x517dxe),getValueFromPropertyName(_0x517dx10,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)))},headers:_0x517dx13[_0x6743[24]],json:true})}}function getEndUserSearchQueryFromChannel(_0x517dxe){var _0x517dx29=_0x6743[60];if(_0x517dxe){switch(_0x517dxe){case _0x6743[62]:_0x517dx29= _0x6743[79];break;default:_0x517dx29= _0x6743[79];logger[_0x6743[18]](_0x6743[63],_0x517dxe)}};return _0x517dx29}function getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf){var _0x517dx29=_0x6743[60];if(_0x517dxe){switch(_0x517dxe){case _0x6743[62]:if(_0x517dxf=== _0x6743[80]){_0x517dx29= _0x6743[81]}else {if(_0x517dxf=== _0x6743[35]){_0x517dx29= _0x6743[82]}};break;default:_0x517dx29= _0x6743[82];logger[_0x6743[18]](_0x6743[63],_0x517dxe)}};return _0x517dx29}function getEndUserNamePropertyFromChannel(_0x517dxe,_0x517dxf){var _0x517dx29=_0x6743[60];if(_0x517dxe){switch(_0x517dxe){case _0x6743[62]:if(_0x517dxf=== _0x6743[80]){_0x517dx29= _0x6743[83]}else {if(_0x517dxf=== _0x6743[35]){_0x517dx29= _0x6743[84]}};break;default:_0x517dx29= _0x6743[84];logger[_0x6743[18]](_0x6743[63],_0x517dxe)}};return _0x517dx29}function handleEndUser(_0x517dx13,_0x517dxe,_0x517dx37,_0x517dxf){return function(_0x517dx10){if(_0x517dx10[_0x6743[69]][_0x6743[68]]> 0&& _0x517dx10[_0x6743[70]]> 0){logger[_0x6743[14]](_0x6743[85],getValueFromPropertyName(_0x517dx37,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)));_0x517dx13[_0x6743[86]]= _0x517dx10[_0x6743[69]][0];return _0x517dx13[_0x6743[86]]};return}}function endUserCreation(_0x517dx13,_0x517dxe,_0x517dx37,_0x517dxf){return function(_0x517dx10){if(_0x517dx10){return};logger[_0x6743[14]](_0x6743[87],getValueFromPropertyName(_0x517dx37,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)));logger[_0x6743[88]](getJsonForEndUserCreation(_0x517dxe,_0x517dx37,_0x517dxf));return rp({uri:_0x517dx13[_0x6743[23]]+ _0x6743[89],method:_0x6743[90],body:{user:getJsonForEndUserCreation(_0x517dxe,_0x517dx37,_0x517dxf)},headers:_0x517dx13[_0x6743[24]],json:true})}}function getJsonForEndUserCreation(_0x517dxe,_0x517dx10,_0x517dxf){var _0x517dx3a={role:_0x6743[91]};switch(_0x517dxe){case _0x6743[62]:if(_0x517dxf=== _0x6743[35]){if(isValidName(_0x517dx10[_0x6743[84]])){_0x517dx3a[_0x6743[36]]= getValueFromPropertyName(_0x517dx10,getEndUserNamePropertyFromChannel(_0x517dxe,_0x517dxf))}else {_0x517dx3a[_0x6743[36]]= util[_0x6743[59]](_0x6743[92],getValueFromPropertyName(_0x517dx10,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)))}}else {if(_0x517dxf=== _0x6743[80]){if(isValidName(_0x517dx10[_0x6743[83]])){_0x517dx3a[_0x6743[36]]= getValueFromPropertyName(_0x517dx10,getEndUserNamePropertyFromChannel(_0x517dxe,_0x517dxf))}else {_0x517dx3a[_0x6743[36]]= util[_0x6743[59]](_0x6743[92],getValueFromPropertyName(_0x517dx10,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)))}}};_0x517dx3a[_0x6743[79]]= getValueFromPropertyName(_0x517dx10,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf));break;default:logger[_0x6743[18]](_0x6743[63],_0x517dxe)};return _0x517dx3a}function isValidName(_0x517dx3c){return _0x517dx3c&& _0x517dx3c!== _0x6743[93]}function handleEndUserCreation(_0x517dx13,_0x517dxe,_0x517dx37,_0x517dxf){return function(_0x517dx10){if(!_0x517dx10){return};if(_0x517dx10[_0x6743[75]]){logger[_0x6743[14]](_0x6743[94],getValueFromPropertyName(_0x517dx37,getEndUserSearchPropertyFromChannel(_0x517dxe,_0x517dxf)));_0x517dx13[_0x6743[86]]= _0x517dx10[_0x6743[75]]};return}}function ticketCreation(_0x517dx13,_0x517dx37,_0x517dx11){return function(){var _0x517dx3f={requester_id:_0x517dx13[_0x6743[86]][_0x6743[42]],submitter_id:_0x517dx13[_0x6743[32]][_0x6743[42]],assignee_id:_0x517dx13[_0x6743[32]][_0x6743[42]],tags:createTagsFromConfiguration(_0x517dx13),subject:createSubjectFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11),comment:{public:false,body:createDescriptionFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11)},custom_fields:createCustomFieldsFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11)};var _0x517dx40=createFieldsFromConfiguration(_0x517dx13);if(_0x517dx40[_0x6743[68]]> 0){_[_0x6743[96]](_0x517dx40,function(_0x517dx41){_0x517dx3f[_0x517dx41[_0x6743[42]]]= _0x517dx41[_0x6743[95]]})};logger[_0x6743[88]](_0x6743[97],_0x517dx3f);return rp({uri:_0x517dx13[_0x6743[23]]+ _0x6743[98],method:_0x6743[90],body:{ticket:_0x517dx3f},headers:_0x517dx13[_0x6743[24]],json:true})}}function createTagsFromConfiguration(_0x517dx13){var _0x517dx43=[];if(_0x517dx13[_0x6743[22]][_0x6743[99]][_0x6743[68]]> 0){_0x517dx43= _[_0x6743[100]](_0x517dx13[_0x6743[22]].Tags,_0x6743[36])};return _0x517dx43}function createSubjectFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11){var _0x517dx45=_0x6743[60];var _0x517dx46=[];if(_0x517dx13[_0x6743[22]][_0x6743[101]][_0x6743[68]]> 0){var _0x517dx47=_[_0x6743[102]](_0x517dx13[_0x6743[22]].Subject,[_0x6743[42]]);_[_0x6743[96]](_0x517dx47,function(_0x517dx48){if(_0x517dx48[_0x6743[103]]=== _0x6743[104]){_0x517dx46[_0x6743[106]](_0x517dx48[_0x6743[105]])}else {if(_0x517dx48[_0x6743[103]]=== _0x6743[107]&& _0x517dx48[_0x6743[108]]){var _0x517dx49=getValueFromPropertyName(_0x517dx37,_0x517dx48[_0x6743[108]],_0x517dx13);if(_0x517dx49){_0x517dx46[_0x6743[106]](_0x517dx49.toString())}}else {if(_0x517dx48[_0x6743[103]]=== _0x6743[109]&& _0x517dx48[_0x6743[110]]&& _0x517dx48[_0x6743[110]][_0x6743[36]]){_0x517dx11[_0x517dx48[_0x6743[110]][_0x6743[36]]]&& _0x517dx46[_0x6743[106]](_0x517dx11[_0x517dx48[_0x6743[110]][_0x6743[36]]].toString())}}}});_0x517dx45= _0x517dx46[_0x6743[112]](_0x6743[111])};return _0x517dx45}function createDescriptionFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11){var _0x517dx4b=_0x6743[60];var _0x517dx46=[];if(_0x517dx13[_0x6743[22]][_0x6743[113]][_0x6743[68]]> 0){var _0x517dx4c=_[_0x6743[102]](_0x517dx13[_0x6743[22]].Description,[_0x6743[42]]);_[_0x6743[96]](_0x517dx4c,function(_0x517dx48){if(_0x517dx48[_0x6743[103]]=== _0x6743[104]){_0x517dx46[_0x6743[106]](_0x517dx48[_0x6743[105]])}else {if(_0x517dx48[_0x6743[103]]=== _0x6743[114]){if(_0x517dx48[_0x6743[115]]=== _0x6743[104]&& _0x517dx48[_0x6743[116]]){_0x517dx46[_0x6743[106]](util[_0x6743[59]](_0x6743[117],_0x517dx48[_0x6743[116]],_0x517dx48[_0x6743[118]]))}else {if(_0x517dx48[_0x6743[115]]=== _0x6743[107]&& _0x517dx48[_0x6743[108]]&& _0x517dx48[_0x6743[116]]){var _0x517dx49=getValueFromPropertyName(_0x517dx37,_0x517dx48[_0x6743[108]],_0x517dx13);if(_0x517dx49){_0x517dx46[_0x6743[106]](util[_0x6743[59]](_0x6743[117],_0x517dx48[_0x6743[116]],_0x517dx49.toString()))}}else {if(_0x517dx48[_0x6743[115]]=== _0x6743[109]&& _0x517dx48[_0x6743[110]]&& _0x517dx48[_0x6743[110]][_0x6743[36]]&& _0x517dx48[_0x6743[116]]){_0x517dx11[_0x517dx48[_0x6743[110]][_0x6743[36]]]&& _0x517dx46[_0x6743[106]](util[_0x6743[59]](_0x6743[117],_0x517dx48[_0x6743[116]],_0x517dx11[_0x517dx48[_0x6743[110]][_0x6743[36]]]))}}}}}});_0x517dx4b= _0x517dx46[_0x6743[112]](_0x6743[119])};return _0x517dx4b}function createCustomFieldsFromConfiguration(_0x517dx13,_0x517dx37,_0x517dx11){var _0x517dx4e=[];var _0x517dx4f=[];if(_0x517dx13[_0x6743[22]][_0x6743[120]][_0x6743[68]]> 0){_0x517dx4e= _[_0x6743[121]](_0x517dx13[_0x6743[22]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":true});_[_0x6743[96]](_0x517dx4e,function(_0x517dx41){if(_0x517dx41[_0x6743[103]]=== _0x6743[104]&& _0x517dx41[_0x6743[122]]){_0x517dx4f[_0x6743[106]]({id:_0x517dx41[_0x6743[122]],value:_0x517dx41[_0x6743[105]]})}else {if(_0x517dx41[_0x6743[103]]=== _0x6743[107]&& _0x517dx41[_0x6743[108]]&& _0x517dx41[_0x6743[122]]){var _0x517dx49=getValueFromPropertyName(_0x517dx37,_0x517dx41[_0x6743[108]],_0x517dx13);if(_0x517dx49){_0x517dx4f[_0x6743[106]]({id:_0x517dx41[_0x6743[122]],value:_0x517dx49.toString()})}}else {if(_0x517dx41[_0x6743[103]]=== _0x6743[109]&& _0x517dx41[_0x6743[110]]&& _0x517dx41[_0x6743[110]][_0x6743[36]]&& _0x517dx41[_0x6743[122]]){_0x517dx11[_0x517dx41[_0x6743[110]][_0x6743[36]]]&& _0x517dx4f[_0x6743[106]]({id:_0x517dx41[_0x6743[122]],value:_0x517dx11[_0x517dx41[_0x6743[110]][_0x6743[36]]].toString()})}}}})};return _0x517dx4f}function createFieldsFromConfiguration(_0x517dx13){var _0x517dx40=[];var _0x517dx4f=[];if(_0x517dx13[_0x6743[22]][_0x6743[120]][_0x6743[68]]> 0){_0x517dx40= _[_0x6743[121]](_0x517dx13[_0x6743[22]].Field,{"\x63\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64":false});_[_0x6743[96]](_0x517dx40,function(_0x517dx41){if(_0x517dx41[_0x6743[103]]=== _0x6743[104]&& _0x517dx41[_0x6743[123]]){_0x517dx4f[_0x6743[106]]({id:_0x517dx41[_0x6743[123]],value:_0x517dx41[_0x6743[105]]})}})};return _0x517dx4f}function handleTicketDisplay(_0x517dx13){return function(_0x517dx10){if(_0x517dx10[_0x6743[124]]){logger[_0x6743[14]](_0x6743[125]);_0x517dx13[_0x6743[124]]= _0x517dx10[_0x6743[124]];if(_0x517dx13[_0x6743[22]][_0x6743[27]][_0x6743[103]]=== _0x6743[126]){var _0x517dx52=util[_0x6743[59]](_0x6743[127],_0x517dx13[_0x6743[32]][_0x6743[42]],_0x517dx13[_0x6743[124]][_0x6743[42]]);return rp({uri:_0x517dx13[_0x6743[23]]+ _0x517dx52,method:_0x6743[90],headers:_0x517dx13[_0x6743[24]],json:true})}else {var _0x517dx53=url[_0x6743[128]](stripTrailingSlash(_0x517dx13[_0x6743[28]]));delete _0x517dx53[_0x6743[129]];delete _0x517dx53[_0x6743[130]];delete _0x517dx53[_0x6743[131]];delete _0x517dx53[_0x6743[132]];delete _0x517dx53[_0x6743[133]];if(_0x517dx53){_0x517dx13[_0x6743[134]]= util[_0x6743[59]](_0x6743[135],url[_0x6743[59]](_0x517dx53),_0x517dx10[_0x6743[124]][_0x6743[42]])}}};return}}function handleReportIntegration(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxc,_0x517dxf,_0x517dx12){return function(){delete _0x517dx10[_0x6743[42]];delete _0x517dx10[_0x6743[136]];delete _0x517dx10[_0x6743[137]];_0x517dx10[_0x6743[138]]= _0x6743[139];_0x517dx10[_0x6743[140]]= _0x517dxe;_0x517dx10[_0x6743[141]]= _0x6743[142];_0x517dx10[_0x6743[143]]= _0x517dx13[_0x6743[124]][_0x6743[42]];_0x517dx10[_0x6743[3]]= _0x517dx13[_0x6743[124]][_0x6743[3]];_0x517dx10[_0x6743[144]]= _0x517dxc;_0x517dx10[_0x6743[145]]= _0x517dxf;_0x517dx10[_0x6743[146]]= _0x517dx13[_0x6743[22]][_0x6743[27]][_0x6743[103]];if(_0x517dx13[_0x6743[134]]){_0x517dx10[_0x6743[3]]= _0x517dx13[_0x6743[134]];_0x517dx12[_0x6743[150]](util[_0x6743[59]](_0x6743[149],_0x517dx10[_0x6743[61]]))[_0x6743[148]](_0x6743[147],_0x517dx10)};return ReportIntegration[_0x6743[151]](_0x517dx10)}}function handleEnd(_0x517dx13,_0x517dx10,_0x517dxe){return function(){logger[_0x6743[14]](util[_0x6743[59]](_0x6743[152],_0x517dx13[_0x6743[124]][_0x6743[42]],_0x517dx13[_0x6743[134]]?_0x6743[153]:_0x6743[154],_0x517dx13[_0x6743[32]][_0x6743[42]]));_0x517dx13= undefined;return}}function handleError(_0x517dx13,_0x517dxe,_0x517dx10,_0x517dxc){return function(_0x517dx57){logger[_0x6743[18]](_0x6743[155]);logger[_0x6743[18]](_0x6743[156],_0x517dx57[_0x6743[157]]);logger[_0x6743[18]](_0x6743[158],_0x517dx57[_0x6743[159]]);_0x517dx13= undefined;delete _0x517dx10[_0x6743[42]];delete _0x517dx10[_0x6743[136]];delete _0x517dx10[_0x6743[137]];_0x517dx10[_0x6743[138]]= _0x6743[139];_0x517dx10[_0x6743[140]]= _0x517dxe;_0x517dx10[_0x6743[141]]= _0x6743[160];_0x517dx10[_0x6743[144]]= _0x517dxc;ReportIntegration[_0x6743[151]](_0x517dx10)[_0x6743[20]](function(){return})[_0x6743[19]](function(_0x517dx57){logger[_0x6743[18]](_0x6743[161]);return})}}function stripTrailingSlash(_0x517dx59){if(_0x517dx59[_0x6743[162]](-1) === _0x6743[163]){return _0x517dx59[_0x6743[162]](0,_0x517dx59[_0x6743[68]]- 1)};return _0x517dx59}module[_0x6743[164]]= Zendesk